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)