>>> m=re.match(r'WwW\.(.*)\..{3}','www.python.org')
>>> m.group(1)
Traceback (most recent call last):
File "<pyshell#32>", line 1, in <module>
m.group(1)
AttributeError: 'NoneType' object has no attribute 'group'
这个问题是因为WwW这里错了,没有获得对应的值
改为以下代码:
>>> m=re.match(r'www\.(.*)\..{3}','www.python.org')
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) | Powered by Discuz! X3.2 |