forked from miczar1/djfz-24_25
D4 done, do sprawdzenia
This commit is contained in:
parent
4c38c40be3
commit
639d5f9356
18
TaskD04/taskD4.py
Normal file
18
TaskD04/taskD4.py
Normal file
@ -0,0 +1,18 @@
|
||||
import re
|
||||
|
||||
final = []
|
||||
|
||||
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
|
||||
lines = file.readlines()
|
||||
pattern = r'(\D*\d+\D+?)\d+(.*)'
|
||||
|
||||
|
||||
for line in lines:
|
||||
line = line.strip()
|
||||
line = re.sub(pattern, r'\1\2', line, count=1)
|
||||
print(line)
|
||||
final.append(line)
|
||||
|
||||
with open('polish_wiki_excerpt.out', 'w', encoding='utf8') as file:
|
||||
for line in final:
|
||||
file.write(line + '\n')
|
Loading…
Reference in New Issue
Block a user