automata-labs/TaskA02/solution.py

15 lines
413 B
Python
Raw Normal View History

2024-10-28 16:00:27 +01:00
import sys
# return if the sentence contains word pies
def solve(lines):
return [l for l in lines if "pies" in l.lower().split(" ")]
if __name__ == "__main__":
lines = []
fp = sys.argv[1]
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)