1.Usage
1 2 3 4 5 6 7 |
import re re.match(r'正则表达式', str) re.findall(r'正则表达式', str) |
2. Difference
match will only return one value which is first matched in string, and the type of return value is <class ‘re.Match’>
findall will return all matched options in string , and the type of reutrn value is <class ‘list’>