d03
This commit is contained in:
parent
e1be7d9d73
commit
c40716abe8
@ -2,7 +2,7 @@ import re
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
def find_hamlet_lines(file_path):
|
def find_hamlet_lines(file_path):
|
||||||
with open(file_path, 'r') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
|
|
||||||
hamlet_lines = []
|
hamlet_lines = []
|
||||||
|
@ -2,7 +2,7 @@ import re
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
def find_pies_lines(file_path):
|
def find_pies_lines(file_path):
|
||||||
with open(file_path, 'r') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
|
|
||||||
pies_lines = []
|
pies_lines = []
|
||||||
|
19
TaskD03/run.py
Normal file
19
TaskD03/run.py
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import re
|
||||||
|
import os
|
||||||
|
|
||||||
|
def find_date_lines(file_path):
|
||||||
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
|
||||||
|
pies_lines = []
|
||||||
|
pattern = re.compile(r'19[0-9][0-9] r\.')
|
||||||
|
|
||||||
|
for _, line in enumerate(lines, start=1):
|
||||||
|
if re.search(pattern, line):
|
||||||
|
pies_lines.append(line)
|
||||||
|
|
||||||
|
return pies_lines
|
||||||
|
|
||||||
|
path = os.path.join(os.path.dirname(__file__), 'simple.in')
|
||||||
|
lines = find_date_lines(path)
|
||||||
|
print(lines)
|
Loading…
Reference in New Issue
Block a user