30 lines
789 B
Python
30 lines
789 B
Python
|
|
||
|
def checkDigit(char):
|
||
|
digits=['1','2','3','4','5','6','7','8','9']
|
||
|
for j in range(len(digits)):
|
||
|
if char==digits[j]:
|
||
|
return char
|
||
|
return None
|
||
|
|
||
|
def checkMaxDigitsSub(fileToCheck):
|
||
|
with open(fileToCheck, "r", encoding="utf-8") as sampleCheck:
|
||
|
word = ''
|
||
|
previousChar=''
|
||
|
for row in sampleCheck:
|
||
|
for char in row:
|
||
|
|
||
|
if char == '\n':
|
||
|
if word != '':
|
||
|
print(word)
|
||
|
word = ''
|
||
|
|
||
|
if checkDigit(char):
|
||
|
if not checkDigit(previousChar):
|
||
|
word += ' '
|
||
|
word += char
|
||
|
previousChar = char
|
||
|
|
||
|
file = 'simple.exp'
|
||
|
checkMaxDigitsSub(file)
|
||
|
|