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方法时就会报上面的error。
# 错误写法:将extend的返回值赋值给aa,导致aa此时成为NoneType类型

# 正确写法:直接使用,不用返回值

AttributeError: 'NoneType' object has no attribute 'extend'的更多相关文章
- AttributeError: 'tuple' object has no attribute 'extend'
出错demo In [5]: a.extend([4,5]) --------------------------------------------------------------------- ...
- python3 AttributeError: 'NoneType' object has no attribute 'split'
from wsgiref.simple_server import make_server def RunServer(environ, start_response): start_response ...
- AttributeError: 'NoneType' object has no attribute 'split' 报错处理
报错场景 social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别, 因此需要进行更改自行支持 JWT 方式 ...
- python提示AttributeError: 'NoneType' object has no attribute 'append'【转发】
在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...
- python提示AttributeError: 'NoneType' object has no attribute 'append'
在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...
- Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'
问题说明: 首先呢,报这个错误的代码是这行代码: model = Model(inputs=input, outputs=output) 报错: AttributeError 'NoneType' o ...
- pyspark AttributeError: 'NoneType' object has no attribute 'setCallSite'
pyspark: AttributeError: 'NoneType' object has no attribute 'setCallSite' 我草,是pyspark的bug.解决方法: prin ...
- 解决opencv:AttributeError: 'NoneType' object has no attribute 'copy'
情况一: 路径中有中文,更改即可 情况二:可以运行代码,在运行结束时显示 AttributeError: 'NoneType' object has no attribute 'copy' 因为如果是 ...
- appium 报错:AttributeError:"NoneType' object has no attribute 'XXX'
报错截图如下: 问题原因: 根据以上报错提示可已看到问题的原因为:logger中没有info此方法的调用,点击"具体报错的位置"上面的链接,可直接定位到具体的报错位置.根据分析所得 ...
随机推荐
- 【2B设计】途牛商旅全案设计
整体设计方案: 途牛商旅全案设计 https://www.uisdc.com/tuniu-business-travel
- 17点睛Spring4.1-@Conditional
17.1 @Conditional @Conditional为按照条件配置spring的bean提供了支持,即满足某种条件下,怎么配置对应的bean; 应用场景 当某一个jar包在classpath中 ...
- PyCharm安装及其使用
1.前提:Python+selenium的安装教程如下网址 https://www.cnblogs.com/linxiu-0925/p/9597634.html 2.PyCharm安装 1.首先去Py ...
- 修复ubuntu 安装mysql后必须使用sudo问题
修改root用户 查看用户的权限,是否是mysql_native_password,如果不是,则将auth_sock改为mysql_native_password update user set pl ...
- es操作手册
0 _search查询数据时可以指定多个index和type GET /index1,index2/type1,type2/_search GET /_all/type1/_search 相当于查询全 ...
- Python 发送微信小程序的模板消息
在小程序的开发过程中,会存在模板消息的发送,具体文档见 这里,模板消息的发送是和语言无关的,这里将简要写一下怎么用 Python 给用户发送模板消息. 通过文档可以知道,发送的时候,需要使用小 ...
- Java基础笔试练习(四)
1.编译Java Application 源程序文件将产生相应的字节码文件,这些字节码文件的扩展名为( ). A.java B.class C.html D.exe 答案: B 解析: Java源程序 ...
- Python13之元组(带上枷锁的列表)
一.元组定义 元组一旦建立,元组内的元素不允许修改和删除,这就是元组和列表最大的区别 当元组中仅有一个元素时,需要将元素后面加上逗号,或者不用括号也可以. tuple1 = (12,3234,5435 ...
- jquery根据html()的内容来选择
<ul><li>First</li><li>http://www.hfxskyyj.com/</li></ul> 如上,如何选中 ...
- C#中使用XML存储数据
创建XML文档 首先引用System.Xml命名空间 1.初始化一个实例 XmlDocument xd = new XmlDocument(); 2.创建XML头文件声明 XmlDeclaration ...