jfz-2023-s464983/TaskE02/run.py

14 lines
376 B
Python

import re
def extract_digits(file_path):
pattern = r'^(\d{2})-\d{3}$'
with open(file_path, 'r', encoding='utf-8') as file:
for line in file:
match = re.match(pattern, line.strip())
if match:
print(match.group(1))
else:
print("<NONE>")
file_path = 'TaskE02/test.in'
extract_digits(file_path)