diff --git a/TaskA02/Task2.py b/TaskA02/Task2.py index 0d04c3e..d85ef4e 100644 --- a/TaskA02/Task2.py +++ b/TaskA02/Task2.py @@ -1,9 +1,4 @@ -# piesArray = [r'[Pp ]', 'i', 'e', 's', r'[ \t\n.,;!?]'] -# pies = ['p', 'i', 'e', 's', '.'] -# if pies == piesArray: -# print('true') - -def openFile(fileName,piesArray = ['[Pp ]', 'i', 'e', 's', '[ \t\n.,;!?]'], patterns = [r'[Pp ]', 'i', 'e', 's', r'[ \t\n.,;!?]']): +def openFile(fileName,piesArray = ['[Pp ]', 'i', 'e', 's', '[ \t\n.,;!?]']): with open(fileName, "r", encoding="utf-8") as file: for row in file: repCounter = 0 @@ -12,9 +7,7 @@ def openFile(fileName,piesArray = ['[Pp ]', 'i', 'e', 's', '[ \t\n.,;!?]'], patt for i in row: if i in piesArray[counter]: if i != ' ' or counter != 0: - # print(piesArray[4]) checkWord+=i - # print(checkWord) counter+=1 if len(checkWord) >= 5: sum = 0 @@ -29,11 +22,6 @@ def openFile(fileName,piesArray = ['[Pp ]', 'i', 'e', 's', '[ \t\n.,;!?]'], patt if repCounter == 1: print(row.strip()) - # checkWord = [] - # counter = 0 - # repCounter+=1 #if in one row more than one Hamlet it will write the row only once - # if repCounter == 1: - # print(row.strip()) else: checkWord = [] counter = 0