jezyki-formalne/TaskA04/task4.py

26 lines
561 B
Python

with open('polish_wiki_excerpt.in', encoding='utf8') as f:
lines = f.readlines()
for line in lines:
line = line.strip()
subdigits = []
pom = ''
for char in line:
if char.isdigit():
pom += char
elif pom != '':
subdigits.append(pom)
pom = ''
else:
pass
if pom.isdigit():
subdigits.append(pom)
if len(subdigits) > 0:
finalLine = ' '.join(subdigits)
print(finalLine)