zadania D
This commit is contained in:
parent
00ae11c0fe
commit
fc27a08b69
@ -1,6 +1,6 @@
|
||||
import sys
|
||||
|
||||
fsa_file = "./small2.in" # FSA FILE
|
||||
fsa_file = "./medium.in" # FSA FILE
|
||||
fsa = {}
|
||||
|
||||
with open(fsa_file, 'r', encoding='utf-8') as f:
|
||||
|
37741
TaskC06/test.txt
37741
TaskC06/test.txt
File diff suppressed because it is too large
Load Diff
11
TaskD01/run.py
Normal file
11
TaskD01/run.py
Normal file
@ -0,0 +1,11 @@
|
||||
import re
|
||||
|
||||
def find_hamlet_lines(file_path):
|
||||
with open(file_path, 'r') as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
if re.search(r'\bHamlet\b', line):
|
||||
print(f"{line}")
|
||||
|
||||
file_path = './simple.in'
|
||||
find_hamlet_lines(file_path)
|
11
TaskD02/run.py
Normal file
11
TaskD02/run.py
Normal file
@ -0,0 +1,11 @@
|
||||
import re
|
||||
|
||||
def find_pies_lines(file_path):
|
||||
with open(file_path, 'r',encoding = 'utf-8') as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
if re.search(r'\bpies\b', line, flags=re.IGNORECASE):
|
||||
print(f"{line}")
|
||||
|
||||
file_path = './simple.in'
|
||||
find_pies_lines(file_path)
|
12
TaskD03/run.py
Normal file
12
TaskD03/run.py
Normal file
@ -0,0 +1,12 @@
|
||||
import re
|
||||
|
||||
def find_date_lines(file_path):
|
||||
with open(file_path, 'r',encoding = 'utf-8') as file:
|
||||
for line in file:
|
||||
line = line.strip()
|
||||
match = re.search(r'.*19[0-9][0-9] r\..*', line)
|
||||
if match:
|
||||
print(f"{line}")
|
||||
|
||||
file_path = './simple.in'
|
||||
find_date_lines(file_path)
|
12
TaskD04/run.py
Normal file
12
TaskD04/run.py
Normal file
@ -0,0 +1,12 @@
|
||||
import re
|
||||
|
||||
def find_all_digit_substrings(file_path):
|
||||
with open(file_path, 'r') as file:
|
||||
lines = file.readlines()
|
||||
for line in lines:
|
||||
digit_substrings = re.findall(r'\d+', line)
|
||||
if digit_substrings:
|
||||
print(' '.join(digit_substrings))
|
||||
|
||||
file_path = './simple.in'
|
||||
find_all_digit_substrings(file_path)
|
Loading…
Reference in New Issue
Block a user