forked from miczar1/djfz-24_25
pobranie danych, dziala ale potencjalny blad w rozwiazaniach
This commit is contained in:
parent
bf20d2f3a0
commit
c8de88b936
File diff suppressed because one or more lines are too long
@ -1,10 +1,27 @@
|
||||
with open("simple.in", encoding="utf-8") as f:
|
||||
with open("polish_wiki_excerpt.in", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
line = line.split()
|
||||
for i in range(len(line)-1):
|
||||
if line[i][:2] == "19":
|
||||
if 0 < int(line[i][3:4]) < 99:
|
||||
if line[i+1][:2] == "r.":
|
||||
print(" ".join(line))
|
||||
|
||||
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)
|
||||
|
Loading…
Reference in New Issue
Block a user