diff --git a/TaskB01/task1.py b/TaskB01/task1.py index e636911..b5a6746 100644 --- a/TaskB01/task1.py +++ b/TaskB01/task1.py @@ -2,8 +2,9 @@ import regex as re with open('shakespeare.in', encoding='utf8') as file: lines = file.readlines() + pattern = re.compile(r'Hamlet') for line in lines: line = line.strip() - x = re.search(r'Hamlet', line) + x = re.search(pattern, line) if x: print(line) \ No newline at end of file diff --git a/TaskB02/task2.py b/TaskB02/task2.py index e69de29..1cd5442 100644 --- a/TaskB02/task2.py +++ b/TaskB02/task2.py @@ -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) \ No newline at end of file