18 lines
755 B
Python
18 lines
755 B
Python
|
def findDate(filename):
|
||
|
|
||
|
with open(filename, 'r', encoding="utf-8") as file:
|
||
|
line_number = 1
|
||
|
for line in file:
|
||
|
if len(line) >= 7:
|
||
|
for i in range(len(line) - 6):
|
||
|
if line[i] == '1' and line[i+1] == '9':
|
||
|
char3 = line[i + 2] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||
|
char4 = line[i + 3] in ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9']
|
||
|
if char3 and char4:
|
||
|
if line[i+4] == ' ' and line[i+5] == 'r' and line[i+6] == '.':
|
||
|
print(f"Line {line_number}")
|
||
|
break
|
||
|
line_number += 1
|
||
|
|
||
|
findDate('TaskA03/simple.in')
|