djfz-24_25/TaskB02/task2.py

10 lines
279 B
Python
Raw Normal View History

2024-11-25 12:14:04 +01:00
import regex as re
2024-11-25 12:29:21 +01:00
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
2024-11-25 12:14:04 +01:00
lines = file.readlines()
2024-11-25 12:44:15 +01:00
pattern = r'( |[Pp])ies(( \w+)|(\.$))'
2024-11-25 12:14:04 +01:00
for line in lines:
line = line.strip()
2024-11-25 12:29:21 +01:00
x = re.search(pattern, line)
if x:
print(line)