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此方法的调用,点击"具体报错的位置"上面的链接,可直接定位到具体的报错位置.根据分析所得 ...
随机推荐
- python中验证码连通域分割的方法详解
python中验证码连通域分割的方法详解 这篇文章主要给大家介绍了关于python中验证码连通域分割的相关资料,文中通过示例代码介绍的非常详细,对大家学习或者使用python具有一定的参考学习价值,需 ...
- ibatis 参数 指定类型
文档: http://ibatis.apache.org/docs/dotnet/datamapper/ch03s04.html <update id="UpdateAccountVi ...
- 雨幕——RainCurtian
今天19年10月14日,也不算是个什么特别的日子.不多能让我的这一天变得特殊的,或许就是在今天我开通了我的第一个博客吧.细想过来每一天都是那么的相似,不过是因为有了某些事情,才变得特殊起来,比如新生命 ...
- Andrew Ng机器学习课程10
Andrew Ng机器学习课程10 a example 如果hypothesis set中的hypothesis是由d个real number决定的,那么用64位的计算机数据表示的话,那么模型的个数一 ...
- linux 下修改时间
修改linux的时间可以使用date指令 date命令的功能是显示和设置系统日期和时间. 输入date 查看目前系统时间. 修改时间需要 date -功能字符 修改内容 命令中各选项的含义分别为: - ...
- 【JS】实用/常用函数/Function方法
1.获取日月 时分秒 //获取 月日 getMonth=(time)=>{ var date = new Date(time) <?):(date.getMonth()+) ?'+date ...
- 串的两种模式匹配方式(BF/KMP算法)
前言 串,又称作字符串,它是由0个或者多个字符所组成的有限序列,串同样可以采用顺序存储和链式存储两种方式进行存储,在主串中查找定位子串问题(模式匹配)是串中最重要的操作之一,而不同的算法实现有着不同的 ...
- SQLServer分页查询方法整理以及批量插入操作SqlBulkCopy
分页查询 通用方法:sqlserver 2005 + ROW_NUMBER() OVER()方式: ; TOP NOT IN方式 : ID FROM TripDetail ORDER BY ID) O ...
- Python19之函数和过程
一.函数和过程 函数和过程都是指一段实现特定功能的代码段,如果该代码段有返回值则称为函数,否则称为过程. 注:Python中只有函数而没有过程,就算是函数体内没有return语句返回一个值,Pytho ...
- spring整合MQ
---恢复内容开始--- 一. 导入依赖 <dependencies> <!-- ActiveMQ客户端完整jar包依赖 --> <dependency> < ...