正則表達式中出現AttributeError: 'NoneType' object has no attribute 'group'問題

在運用正則表達式作匹配的過程當中可能會出現如:AttributeError: 'NoneType' object has no attribute 'group'的錯誤,這主要是因爲沒有匹配到元素,以後又調用了group()方法形成的。python import re content = 'hello world' result = re.match('^w.*d$', content)#這是想
相關文章
相關標籤/搜索