python:re.findall用法
正则 re.findall 的简单用法(返回string中所有与pattern相匹配的全部字串,返回形式为数组)
语法
findall(pattern, string, flags
=
0
)
代码
import re
line = 'Cats are smarter than dogs dogs'
matchObj = re.findall('dogs', line)
if matchObj:
print('use search,the match string is:', matchObj)
else:
print('No search match string!!')