forked from miczar1/djfz-24_25
Compare commits
7 Commits
bcc3d7344f
...
b718541d69
Author | SHA1 | Date | |
---|---|---|---|
b718541d69 | |||
a7892ad185 | |||
834f781e2c | |||
53e7341220 | |||
956123d97e | |||
348556373e | |||
ed65fd5535 |
10
TaskB01/task1.py
Normal file
10
TaskB01/task1.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
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(pattern, line)
|
||||||
|
if x:
|
||||||
|
print(line)
|
10
TaskB02/task2.py
Normal file
10
TaskB02/task2.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import regex as re
|
||||||
|
|
||||||
|
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
pattern = r'( |[Pp])ies(( \w+)|(\.$))'
|
||||||
|
for line in lines:
|
||||||
|
line = line.strip()
|
||||||
|
x = re.search(pattern, line)
|
||||||
|
if x:
|
||||||
|
print(line)
|
File diff suppressed because one or more lines are too long
10
TaskB03/task3.py
Normal file
10
TaskB03/task3.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
pattern = r'19\d\d r\.'
|
||||||
|
for line in lines:
|
||||||
|
line = line.strip()
|
||||||
|
x = re.search(pattern, line)
|
||||||
|
if x:
|
||||||
|
print(line)
|
File diff suppressed because one or more lines are too long
10
TaskB04/task4.py
Normal file
10
TaskB04/task4.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import re
|
||||||
|
|
||||||
|
with open('polish_wiki_excerpt.in', encoding='utf8') as file:
|
||||||
|
lines = file.readlines()
|
||||||
|
pattern = r'\d+'
|
||||||
|
for line in lines:
|
||||||
|
line = line.strip()
|
||||||
|
x = re.findall(pattern, line)
|
||||||
|
if x:
|
||||||
|
print(' '.join(x))
|
Loading…
Reference in New Issue
Block a user