You are on page 1of 44

110、 python正则中search和match

re
s "·J、111j ;i,,'.':-18心 j'_•;:10000"
res re.search(,-" 勹 ",s).group()
("search0,1,'l'.",res)

res re.findall(r"�",s)
("五ndalL,'l'. ",res)

res re .match("'I、'们", s) . group()


("match"."礼",res)

res re.match(r"�",s)
("i人铝, 1、/Jilgroup)-Jnone, 匹配f、1寸」",res)

res re.match(" I ;、", s) . group ()


("match·'.·,• 礼",res)
search呫'4'. 18

indalL',', 宋['18','100的 ]
atch銡宋小明
认铝. -1、/JLJgroup);none, 门肝个到None
raceback (most recent call last):
File "C:\Users\ry-wu.junya\Desktop\1i11i, 1,:,"s.py", line 68, in <module>
res re.match(" I·,;-t ",s) .g 广 oup()
ttributeError:'None Type·object has no attribute'group'
(Finished 1n 0.2s ,,ith exit code l]
匾干:lr.l圈衄喝瞿暑厅霓叶霄靠,增髻嗣鄂财 . .: ..

You might also like