TH4

 avatar
huuductu
python
2 years ago
1.3 kB
1
Indexable
Never
//bai1
import re

fileName = input()
with open(fileName, 'r') as file:
    for line in file:
        t = re.match(r"[tc].*re+.*",line)
        if t:
            print(line, end="")
//bai2
import re

fileName = input()
with open(fileName, 'r') as file:
    for line in file:
        t = re.match(r".{25,}",line)
        if t:
            print(line, end="")
//bai3
import re

fileName = input()

with open(fileName, 'r') as file:
    for line in file:
        t = re.match(r".+[?!]$",line)
        if t:
            print(line, end="")
//bai4
import re

fileName = input()

with open(fileName, 'r') as file:
    for line in file:
        t = re.findall(r".*regular.*", line)
        if t:
            print(line,end="")
//bai5
import re

fileName = input()
file=open(fileName,'r')
# with open(fileName, 'r') as file:
for line in file:
    t = re.findall(r"(\w+)(.\w+)*@([\w\.\-]+)", line)
    if t:
        print(t[0][2])
//bai6
import re

fileName = input()
def format(date):
    print(date[1]+"/"+date[0]+"/"+date[2],end="")

with open(fileName, 'r') as file:
    for line in file:
        t = re.findall(r"(\d{2}).?(\d{2}).?(\d{4})+", line)
        if t:
            format(t[0])
            print(" ",end="")
            format(t[1])
            print()