djfz-24_25/TaskA03/task3.py

24 lines
714 B
Python

with open("polish_wiki_excerpt.in", encoding="utf-8") as f:
lines = f.readlines()
result = []
for line in lines:
line = line.replace('\xa0', '[NBA]').strip() # eliminujemy problem z 'non breaking space'
line = line.split()
flag1 = False
for word in line:
if flag1:
if word[:2] == 'r.':
goodLine = ' '.join(line)
result.append(goodLine)
print(goodLine)
break
else:
flag1 = False
if word[-4:-2] == '19':
if word[-2] in '0123456789' and word[-1] in '0123456789':
flag1 = True