zadania D

This commit is contained in:
Weranda 2023-11-27 14:34:07 +01:00
parent 00ae11c0fe
commit fc27a08b69
6 changed files with 37784 additions and 5 deletions

View File

@ -1,6 +1,6 @@
import sys import sys
fsa_file = "./small2.in" # FSA FILE fsa_file = "./medium.in" # FSA FILE
fsa = {} fsa = {}
with open(fsa_file, 'r', encoding='utf-8') as f: with open(fsa_file, 'r', encoding='utf-8') as f:

File diff suppressed because it is too large Load Diff

11
TaskD01/run.py Normal file
View 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
View 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
View 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
View 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)