jfz-2023-s473579/TaskA02/TaskAO2.py
2023-10-28 23:13:15 +02:00

31 lines
1.1 KiB
Python

import re
def openFile(fileName,piesArray1 = [' ', 'P', 'p', '('],
piesArray2 = ['i', 'e', 's'],
piesArray3 = ['\t', '\n', '.', ',', ';', '!', '?', ')']):
with open(fileName, "r", encoding="utf-8") as file:
file_contents = file.read()
for row in file:
piesArrayCounter = 0
repCounter = 0
counter = 0
checkWord = ''
for character in row:
if character == ' ':
checkWord+=character
if counter == 0 and checkWord == ' ':
if (character == 'P' or character == 'p'):
counter +=1
print('---------------------SHAKESPEARE.EXP--------------------------------------')
openFile('shakespeare.exp')
print('----------------------SHAKESPEARE.EXP-----------------------------------')
openFile('shakespeare.in')
print('------------------------SIMPLE.IN------------------------------------')
openFile('simple.in')
print('-----------------------SIMPLE.EXP--------------------------------------')
openFile('simple.exp')