原文: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-2025 CODEPRJ.COM