Python:AttributeError: 问题

>>> 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

相关文章
相关标签/搜索