2024-11-14 20:10:52 +01:00
|
|
|
with open("polish_wiki_excerpt.in", encoding="utf-8") as f:
|
2024-10-28 13:00:28 +01:00
|
|
|
lines = f.readlines()
|
|
|
|
for line in lines:
|
|
|
|
line = line.strip()
|
|
|
|
line = line.split()
|
2024-11-14 20:10:52 +01:00
|
|
|
|
|
|
|
flag1 = False # sprawdzam czy slowo jest liczba miedzy 1900 a 1999
|
|
|
|
flag2 = False # sprawdzam czy za liczba jest 'r.'
|
|
|
|
|
|
|
|
for word in line:
|
|
|
|
if word == 'Terespola':
|
|
|
|
pass
|
|
|
|
if flag1:
|
|
|
|
if word[:2] == 'r.':
|
|
|
|
flag2 = True
|
|
|
|
break
|
|
|
|
else:
|
|
|
|
flag1 = False
|
|
|
|
|
|
|
|
if word[len(word)-4 : len(word)-2] == '19':
|
|
|
|
if word[2] in '0123456789' and word[3] in '0123456789':
|
|
|
|
flag1 = True
|
|
|
|
|
|
|
|
|
|
|
|
if flag1 is True and flag2 is True:
|
|
|
|
goodLine = ' '.join(line)
|
|
|
|
print(goodLine)
|