>>> 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'python
這個問題是由於WwW這裏錯了,沒有得到對應的值shell
改成如下代碼:spa
>>> m=re.match(r'www\.(.*)\..{3}','www.python.org')get