原文:AttributeError: 'NoneType' object has no attribute 'extend'

Python使用中可能遇到的小問題 AttributeError: NoneType object has no attribute extend 或者AttributeError: NoneType object has no attribute append 原因:這兩種方法都是沒有返回值的,也就是返回的是NoneType類型,而NoneType數據再次調用extend或者append方法時就 ...

2019-10-28 16:34 0 1996 推薦指數:

查看詳情

AttributeError: 'NoneType' object has no attribute 'find'

遇到這個問題是因為讀取excel表格的數據時默認是str類型,但是excel有空行時,類型讀取為NoneType,如果把類型轉換為str或者把excel里的空行刪掉就不會有這個問題 ...

Thu Dec 26 19:37:00 CST 2019 2 11518
AttributeError: 'tuple' object has no attribute 'extend'

出錯demo 打印一下tuple類型的屬性可以看到,tuple類型除內置類型外,只有count和index兩個屬性 extend是list類型的方法 extend是1個列表+另一個列表, 它會改變原來列表的長度,而不會生成一個新的列表 ...

Mon Jun 24 23:15:00 CST 2019 0 1699
 
粵ICP備18138465號   © 2018-2026 CODEPRJ.COM