forked from miczar1/djfz-24_25
20 lines
681 B
Python
20 lines
681 B
Python
def find_lines_with_date(file_path):
|
|
result = ""
|
|
try:
|
|
with open(file_path, 'r', encoding='utf-8') as file:
|
|
for line_number, line in enumerate(file, start=1):
|
|
for i in range(len(line) - 6):
|
|
if (
|
|
line[i:i+2] == "19" and
|
|
line[i+2:i+4].isdigit() and
|
|
line[i+4:i+7] == " r."
|
|
):
|
|
result += line
|
|
break
|
|
except Exception as e:
|
|
print(f"An error occurred: {e}")
|
|
print(result)
|
|
|
|
find_lines_with_date("TaskA03/simple.in")
|
|
find_lines_with_date("TaskA03/polish_wiki_excerpt.in")
|