bez numerów linii
This commit is contained in:
parent
3908ac94e6
commit
afd599225c
@ -1,12 +1,10 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
def hamlet_reg(file_path):
|
def hamlet_reg(file_path):
|
||||||
licznik = 0
|
|
||||||
with open(file_path, 'r', encoding='utf-8') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
licznik += 1
|
|
||||||
if (re.search("'.*Hamlet.*", line)):
|
if (re.search("'.*Hamlet.*", line)):
|
||||||
print(f"{licznik}: {line.strip()}")
|
print(line.strip())
|
||||||
|
|
||||||
file_path = 'TaskD01\simple.in'
|
file_path = 'TaskD01\simple.in'
|
||||||
hamlet_reg(file_path)
|
hamlet_reg(file_path)
|
@ -1,12 +1,10 @@
|
|||||||
import re
|
import re
|
||||||
|
|
||||||
def pies_reg(file_path):
|
def pies_reg(file_path):
|
||||||
licznik = 0
|
|
||||||
with open(file_path, 'r', encoding='utf-8') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
licznik += 1
|
|
||||||
if (re.search("(^|\s)pies($|\s)", line, re.IGNORECASE)):
|
if (re.search("(^|\s)pies($|\s)", line, re.IGNORECASE)):
|
||||||
print(f"{licznik}: {line.strip()}")
|
print(line.strip())
|
||||||
|
|
||||||
|
|
||||||
file_path = 'TaskD02\simple.in'
|
file_path = 'TaskD02\simple.in'
|
||||||
|
@ -6,12 +6,10 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
def data_reg(file_path):
|
def data_reg(file_path):
|
||||||
licznik = 0
|
|
||||||
with open(file_path, 'r', encoding='utf-8') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
licznik += 1
|
|
||||||
if (re.search(".*19\d{2} r\..*", line)):
|
if (re.search(".*19\d{2} r\..*", line)):
|
||||||
print(f"{licznik}: {line.strip()}")
|
print(line.strip())
|
||||||
|
|
||||||
|
|
||||||
file_path = 'TaskD03\simple.in'
|
file_path = 'TaskD03\simple.in'
|
||||||
|
@ -6,13 +6,11 @@ import re
|
|||||||
|
|
||||||
|
|
||||||
def liczby_reg(file_path):
|
def liczby_reg(file_path):
|
||||||
licznik = 0
|
|
||||||
with open(file_path, 'r', encoding='utf-8') as file:
|
with open(file_path, 'r', encoding='utf-8') as file:
|
||||||
for line in file:
|
for line in file:
|
||||||
licznik += 1
|
|
||||||
number = (re.findall(r'\d+', line))
|
number = (re.findall(r'\d+', line))
|
||||||
if number:
|
if number:
|
||||||
print(f"{licznik}: {' '.join(number)}")
|
print(' '.join(number))
|
||||||
|
|
||||||
|
|
||||||
file_path = 'TaskD04\simple.in'
|
file_path = 'TaskD04\simple.in'
|
||||||
|
Loading…
Reference in New Issue
Block a user