Traceback (most recent call last): File "AttributeError: 'NoneType' object has no attribute 'group'
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
標題太長,放不下。這裡再說一遍。
失敗的情況:
>>> m = re.search(r'PY.*N', 'FBHNS')
>>> m.group(0)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'NoneType' object has no attribute 'group'
這個是因為,沒有一個可以成功進行匹配的。
前面的單詞開頭:*PY.N 匹配的必須是:PY開頭的短語!然而,被匹配的短語是:FBHNS。所以會匹配失敗!
改正後成功的一次:
程式碼如下:
>>> m = re.search(r'PY.*N', 'PYGUHNCWDJCNSDXS')
>>> m.group(0)
'PYGUHNCWDJCN'
>>>
前面的單詞開頭:*PY.N 匹配的必須是:PY開頭的短語!然而,被匹配的短語是:PYGUHNCWDJCNSDXS。所以會匹配成功!
所有嘗試:
相關文章
- Traceback (most recent call last):AST
- Traceback (most recent call last): File "/usr/bin/firewall-cmd", line 24, in from gi.AST
- 問題解決:AttributeError: ‘NoneType‘ object has no attribute ‘append‘ErrorNoneObjectAPP
- 爬蟲中經常出現Traceback (most recent call last):問題解決!!!爬蟲AST
- AttributeError: 'dict' object has no attribute 'has_key'ErrorObject
- AttributeError: 'module' object has no attribute 'lock'ErrorObject
- 【坑】Tkinter ‘NoneType‘ object has no attribute ‘destroy‘NoneObject
- AttributeError: 'Settings' object has no attribute 'HBase'ErrorObject
- AttributeError: module ‘requests‘ has no attribute ‘_version_‘Error
- Rasa init報錯:AttributeError: type object 'Callable' has no attribute '_abc_registry'ErrorObject
- Process object has no attribute '_popen'Object
- ‘dict‘ object has no attribute ‘iteritems‘Object
- [轉]成功解決AttributeError: module ‘enum‘ has no attribute ‘IntFlag‘?Error
- ‘FirewallD‘ object has no attribute ‘path‘ 、‘fw‘、is not registeredObject
- module ‘h5py‘ has no attribute ‘File‘H5
- AttributeError: module...ops‘ has no attribute ‘_TensorLike‘, ValueError: `updates` argument..eagerError
- AttributeError: module ‘tensorflow._api.v1.nn.rnn_cell‘ has no attribute ‘InputProjectionWrapper‘ErrorAPIRNNProjectAPP
- 【Error】AttributeError: module ‘scipy.misc‘ has no attribute ‘logsumexp‘ 的解決辦法Error
- 1_使用face_recognition模組:錯誤AttributeError:'PngStream' object has no attribute 'chunk fcWp'(20190223)ErrorObject
- AttributeError: module‘ tensorflow_core._api.v2. train‘ has no attribute‘ AdamOptimizer‘ErrorAPIAI
- python去掉excel空格和換行,報錯'int' object has no attribute 'strip'PythonExcelObject
- python-unittest 框架利用 PageObject 設計模式在 BasePage 類中呼叫不到 send_keys 方法,執行報錯'NoneType' object has no attribute 'send_keys'Python框架Object設計模式None
- RuntimeWarning: Enable tracemalloc to get the object allocation tracebackObject
- multiprocessing pool AttributeError: Can't get attribute 'func'Error
- 複雜網路中louvain演算法實現時報錯AttributeError: module ‘community‘ has no attribute ‘best_partition‘AI演算法ErrorUnity
- Uncaught TypeError: Object [object Object] has no method 'xxx'ErrorObject
- module ‘tensorflow‘ has no attribute ‘get_default_graph‘
- Uncaught TypeError: Object # has no method 'load'ErrorObject
- 解決pycharm問題:module 'pip' has no attribute 'main'PyCharmAI
- CRASH with error- last checkpoint exceed log group capacityErrorAST
- v$session中LAST_CALL_ET引數的理解SessionAST
- According to TLD or attribute directive in tag file, attribute value does not accept any expressionExpress
- Why Object.prototype.hasOwnProperty.call(myObj, prop)Object
- 解決The jar file has no source attachment問題JAR
- "Fatal error: Call to undefined function: file_put_contents()"ErrorUndefinedFunction
- toStirng()與Object.prototype.toString.call()方法淺談Object
- libmysqlclient.so.16: cannot open shared object file: No such file or directoryIBMMySqlclientObject
- libcap.so.1:cannot open shared object file: No such file or directoryObject