001、match
>>> import re >>> str1 = "www.baidu.com" ## 测试字符串 >>> re.match("www", str1) <re.Match object; span=(0, 3), match='www'> >>> re.match("www", str1).span() ## 返回匹配的范围 (0, 3)