inflab3/dop1.py
2023-07-21 01:06:53 +03:00

23 lines
600 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Дополнительное задание №1
# Номер в ИСУ: 316304
# Вариант: 2
import re
from smiley import get_args
regex = [re.compile('ВТ\W*\s+(?:\w+\W+){,4}ИТМО'), re.compile('\W+')]
def parse(text):
result = re.findall(regex[0], text)
result = [re.sub(regex[1], ' ', s) for s in result]
return result
if __name__ == '__main__':
out = parse(get_args())
print("Результат работы:")
for n, i in enumerate(out):
print(str(n + 1) + ') ' + str(i))
if len(out) == 0:
print("Ничего не найдено")