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
- 問題解決:AttributeError: ‘NoneType‘ object has no attribute ‘append‘ErrorNoneObjectAPP
- 爬蟲中經常出現Traceback (most recent call last):問題解決!!!爬蟲AST
- AttributeError: 'Settings' object has no attribute 'HBase'ErrorObject
- 【坑】Tkinter ‘NoneType‘ object has no attribute ‘destroy‘NoneObject
- Rasa init報錯:AttributeError: type object 'Callable' has no attribute '_abc_registry'ErrorObject
- AttributeError: module ‘requests‘ has no attribute ‘_version_‘Error
- Process object has no attribute '_popen'Object
- ‘dict‘ object has no attribute ‘iteritems‘Object
- [轉]成功解決AttributeError: module ‘enum‘ has no attribute ‘IntFlag‘?Error
- 1_使用face_recognition模組:錯誤AttributeError:'PngStream' object has no attribute 'chunk fcWp'(20190223)ErrorObject
- ‘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_core._api.v2. train‘ has no attribute‘ AdamOptimizer‘ErrorAPIAI
- AttributeError: module ‘tensorflow._api.v1.nn.rnn_cell‘ has no attribute ‘InputProjectionWrapper‘ErrorAPIRNNProjectAPP
- 【Error】AttributeError: module ‘scipy.misc‘ has no attribute ‘logsumexp‘ 的解決辦法Error
- 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
- multiprocessing pool AttributeError: Can't get attribute 'func'Error
- RuntimeWarning: Enable tracemalloc to get the object allocation tracebackObject
- 複雜網路中louvain演算法實現時報錯AttributeError: module ‘community‘ has no attribute ‘best_partition‘AI演算法ErrorUnity
- module ‘tensorflow‘ has no attribute ‘get_default_graph‘
- According to TLD or attribute directive in tag file, attribute value does not accept any expressionExpress
- Input報錯“Form elements must have labels: Element has no title attribute Element has no placeholde”ORM
- 解決pycharm問題:module 'pip' has no attribute 'main'PyCharmAI
- Why Object.prototype.hasOwnProperty.call(myObj, prop)Object
- libmysqlclient.so.16: cannot open shared object file: No such file or directoryIBMMySqlclientObject
- 解決The jar file has no source attachment問題JAR
- ImportError: libffi.so.7: cannot open shared object file: No such file or directoryImportErrorObject
- Password is required when adding a database to AG group if the database has a master keyUIDatabaseAST
- 解決 "last line of file ends without a newline" 警告的方法:使用 .editorconfigAST
- MySQL案例01:Last_SQL_Errno: 1755 Cannot execute the current event group in the parallel modeMySqlASTParallel
- java.lang.IllegalStateException: Cannot call sendError() after the response has been committed解讀JavaExceptionErrorMIT
- python中的tracebackPython
- 修復 Ubuntu 中 “E: The package cache file is corrupted, it has the wrong hash”UbuntuPackage
- Syntax Error: ValidationError: Invalid options object. Stylus Loader has been initialized using anErrorObjectZed
- python libclntsh.so.12.1: cannot open shared object filePythonObject