forked from miczar1/djfz-24_25
task1 optimalization
This commit is contained in:
parent
ed65fd5535
commit
348556373e
@ -2,8 +2,9 @@ import regex as re
|
|||||||
|
|
||||||
with open('shakespeare.in', encoding='utf8') as file:
|
with open('shakespeare.in', encoding='utf8') as file:
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
|
pattern = re.compile(r'Hamlet')
|
||||||
for line in lines:
|
for line in lines:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
x = re.search(r'Hamlet', line)
|
x = re.search(pattern, line)
|
||||||
if x:
|
if x:
|
||||||
print(line)
|
print(line)
|
@ -0,0 +1,7 @@
|
|||||||
|
import regex as re
|
||||||
|
|
||||||
|
with open('simple.in', encoding='utf8') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
for line in lines:
|
||||||
|
line = line.strip()
|
||||||
|
print(line)
|
Loading…
Reference in New Issue
Block a user