Begin TaskA04
This commit is contained in:
parent
cd74f9ca4c
commit
58e8d6c4ad
19940
TaskA04/polish_wiki_excerpt.out
Normal file
19940
TaskA04/polish_wiki_excerpt.out
Normal file
File diff suppressed because it is too large
Load Diff
25
TaskA04/solution.py
Normal file
25
TaskA04/solution.py
Normal file
@ -0,0 +1,25 @@
|
||||
import sys
|
||||
|
||||
def solve(lines):
|
||||
res = []
|
||||
|
||||
for l in lines:
|
||||
numbers = []
|
||||
for w in l.split():
|
||||
number = ''.join(filter(lambda c: c.isdigit(), w))
|
||||
if number:
|
||||
numbers.append(number)
|
||||
if numbers:
|
||||
res.append(' '.join(numbers) + '\n')
|
||||
|
||||
return res
|
||||
|
||||
if __name__ == "__main__":
|
||||
lines = []
|
||||
|
||||
fp = sys.argv[1]
|
||||
with open("../TaskA02/polish_wiki_excerpt.in", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
sol = solve(lines)
|
||||
with open("./polish_wiki_excerpt.out", 'w', encoding="utf-8") as f:
|
||||
f.writelines(sol)
|
Loading…
Reference in New Issue
Block a user