NFA2
user_5119020710
python
3 years ago
570 B
16
Indexable
#bai4
import re
f = open("B1.txt")
S = f.read().split("\n")
for e in S:
if re.search(r"\bregular\b", e):
print(e)
f.close()
#Bai 5
import re
f = open("B1.txt")
S = f.read().split("\n")
for e in S:
print(e)
rs = re.search(r"(?<=@).+", e)
if rs:
print(rs.group())
f.close()
#Bài 6
import re
f = open("test3.csv")
S = f.read().split("\n")
for e in S:
print(re.sub(r"([0-9]{2})\.([0-9]{2})\.([0-9]{4})", r"\2/\1/\3", re.sub(r"([0-9]{2})([0-9]{2})([0-9]{4})", r"\2/\1/\3", e)))
f.close()Editor is loading...