automata-labs/TaskB03/solution.py

19 lines
457 B
Python
Raw Normal View History

2024-11-25 16:07:50 +01:00
import sys
import re
def solve(lines):
print(len(lines))
return [l for l in lines if re.search(r"19\d\d r\.", l)]
if __name__ == "__main__":
lines = []
fp = sys.argv[1]
assert("polish_wiki_excerpt" in fp)
print(fp)
with open(fp, 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)