diff --git a/TaskA03/TaskAO3.py b/TaskA03/TaskAO3.py new file mode 100644 index 0000000..3165de5 --- /dev/null +++ b/TaskA03/TaskAO3.py @@ -0,0 +1,28 @@ +def openFile(fileName, ageArray = ['1', '9', '[0123456789]', '[0123456789]', ' ', 'r', '.']): + with open(fileName, "r", encoding="utf-8") as file: + for row in file: + repCounter = 0 + counter = 0 + checkWord =[] + for i in row: + if i in ageArray[counter]: + checkWord+=i + counter +=1 + if counter == 7: + repCounter+=1 + checkWord = [] + counter = 0 + if repCounter == 1: + print(row.strip()) + else: + checkWord = [] + counter = 0 + +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')