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)