Th4

 avatar
huuductu
python
3 years ago
1.4 kB
11
Indexable
//Bai1
import re

fileName = input()
with open(fileName, 'rb') as file:
    for line in file:
        t = re.match("^[tc].*re+.*",line.decode('utf-8'))
        if t:
            print(line.decode('utf-8'), end="")
//Bai2
import re

fileName = input()
with open(fileName, 'rb') as file:
    for line in file:
        t = re.match(".{25,}",line.decode('utf-8'))
        if t:
            print(line.decode('utf-8'), end="")

//Bai3
import re

fileName = input()

with open(fileName, 'r') as file:
    for line in file:
        t = re.match(".+[\?\!]$",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"([\w\.\-]+)@([\w\.\-]+)", line)
        if t:
            print(t[0][1])

//Bai5
import re

fileName = input()

with open(fileName, 'r') as file:
    for line in file:
        t = re.findall(r"([\w\.\-]+)@([\w\.\-]+)", line)
        if t:
            print(t[0][1])

//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()
Editor is loading...