2023-10-28 23:13:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
def checkNumber(i):
|
|
|
|
if (i == '0'
|
|
|
|
or i == '1'
|
|
|
|
or i == '2'
|
|
|
|
or i == '3'
|
|
|
|
or i == '4'
|
|
|
|
or i == '5'
|
|
|
|
or i == '6'
|
|
|
|
or i == '7'
|
|
|
|
or i == '8'
|
|
|
|
or i == '9'):
|
|
|
|
return i
|
|
|
|
def openFile(fileName, ageArray = ['1', '9', None, None, ' ', 'r', '.']):
|
2023-10-25 15:38:54 +02:00
|
|
|
with open(fileName, "r", encoding="utf-8") as file:
|
|
|
|
for row in file:
|
|
|
|
repCounter = 0
|
|
|
|
counter = 0
|
|
|
|
checkWord =[]
|
|
|
|
for i in row:
|
2023-10-28 23:13:15 +02:00
|
|
|
if counter != 2 and counter !=3:
|
|
|
|
if i == ageArray[counter]:
|
|
|
|
checkWord+=i
|
|
|
|
counter +=1
|
|
|
|
else:
|
2023-10-25 15:38:54 +02:00
|
|
|
checkWord = []
|
|
|
|
counter = 0
|
2023-10-28 23:13:15 +02:00
|
|
|
if counter == 7:
|
|
|
|
repCounter+=1
|
|
|
|
checkWord = []
|
|
|
|
counter = 0
|
|
|
|
if repCounter == 1:
|
|
|
|
print(row.strip())
|
|
|
|
|
2023-10-25 15:38:54 +02:00
|
|
|
else:
|
2023-10-28 23:13:15 +02:00
|
|
|
if i==checkNumber(i):
|
|
|
|
checkWord+=i
|
|
|
|
counter+=1
|
|
|
|
else:
|
|
|
|
checkWord = []
|
|
|
|
counter = 0
|
2023-10-25 15:38:54 +02:00
|
|
|
|
|
|
|
print('---------------------SHAKESPEARE.EXP--------------------------------------')
|
|
|
|
openFile('polish_wiki_excerpt.exp')
|
|
|
|
print('----------------------SHAKESPEARE.EXP-----------------------------------')
|
|
|
|
openFile('polish_wiki_excerpt.in')
|
|
|
|
print('------------------------SIMPLE.IN------------------------------------')
|
|
|
|
openFile('simple.in')
|
|
|
|
print('-----------------------SIMPLE.EXP--------------------------------------')
|
|
|
|
openFile('simple.exp')
|