re模块的match()匹配是从字符串的开始位置匹配,只有从0位置匹配成功才有返回,否则返回none
search()匹配字符串中有无符合模式要求的子串
例如:
re.match('world','hello world'),会返回none
re.search(‘world’,‘hello world’).span()返回(6,10)
re模块的match()匹配是从字符串的开始位置匹配,只有从0位置匹配成功才有返回,否则返回none
search()匹配字符串中有无符合模式要求的子串
例如:
re.match('world','hello world'),会返回none
re.search(‘world’,‘hello world’).span()返回(6,10)