2024-11-25 12:09:17 +01:00
|
|
|
import regex as re
|
|
|
|
|
|
|
|
with open('shakespeare.in', encoding='utf8') as file:
|
|
|
|
lines = file.readlines()
|
2024-11-25 12:14:04 +01:00
|
|
|
pattern = re.compile(r'Hamlet')
|
2024-11-25 12:09:17 +01:00
|
|
|
for line in lines:
|
|
|
|
line = line.strip()
|
2024-11-25 12:14:04 +01:00
|
|
|
x = re.search(pattern, line)
|
2024-11-25 12:09:17 +01:00
|
|
|
if x:
|
|
|
|
print(line)
|