jfz-2023-s464983/TaskE02/run.py

14 lines
376 B
Python
Raw Normal View History

2024-01-19 20:41:55 +01:00
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)