在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append'

a=[]

b=[1,2,3,4]

a = a.append(b)

执行一次后发现a的类型变为了NoneType。

下次执行时就会出现如题所示的错误。

把a = a.append(b)改为a.append(b)后问题解决。

原因:append会修改a本身,并且返回None。不能把返回值再赋值给a。

python提示AttributeError: 'NoneType' object has no attribute 'append'的更多相关文章

  1. 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 ...

  2. AttributeError: 'NoneType' object has no attribute 'append'

    大多数是这个原因: gongzi = [] for p in [1,2,3]: gongzi = gongzi.append(p) #改为如下即可 gongzi = [] for p in [1,2, ...

  3. AttributeError: 'NoneType' object has no attribute 'extend'

    Python使用中可能遇到的小问题 AttributeError: 'NoneType' object has no attribute 'extend' 或者AttributeError: 'Non ...

  4. 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法

    今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...

  5. pyspark AttributeError: 'NoneType' object has no attribute 'setCallSite'

    pyspark: AttributeError: 'NoneType' object has no attribute 'setCallSite' 我草,是pyspark的bug.解决方法: prin ...

  6. python3 AttributeError: 'NoneType' object has no attribute 'split'

    from wsgiref.simple_server import make_server def RunServer(environ, start_response): start_response ...

  7. AttributeError: 'NoneType' object has no attribute 'split' 报错处理

    报错场景 social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别, 因此需要进行更改自行支持 JWT 方式 ...

  8. Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'

    问题说明: 首先呢,报这个错误的代码是这行代码: model = Model(inputs=input, outputs=output) 报错: AttributeError 'NoneType' o ...

  9. 解决opencv:AttributeError: 'NoneType' object has no attribute 'copy'

    情况一: 路径中有中文,更改即可 情况二:可以运行代码,在运行结束时显示 AttributeError: 'NoneType' object has no attribute 'copy' 因为如果是 ...

随机推荐

  1. storm 错误汇总

    https://blog.csdn.net/xiaolang85/article/details/38492277

  2. 【Mac + GitHub】之在另一台Mac电脑上下载GitHub的SSH链接报错

    当输入git命令github项目时报错: ⇒ git clone git@github.com:/TX-Class.git Cloning into 'TX-Class'... Warning: Pe ...

  3. ASP.NET中常用的26个优化性能方法

    1. 数据库访问性能优化 数据库的连接和关闭 访问数据库资源需要创建连接.打开连接和关闭连接几个操作.这些过程需要多 次与数据库交换信息以通过身份验证,比较耗费服务器资源.ASP.NET 中提供了 连 ...

  4. RedHat Ent 6.5 64bit编译安装hadoop2.4.1

    RedHat Ent 6.5 64bit编译安装hadoop2.4.1 感谢原帖:http://blog.csdn.net/w13770269691/article/details/16883663/ ...

  5. UML学习目录

    用例图:http://www.cnblogs.com/yjjm/archive/2012/01/28/2385861.html http://kb.cnblogs.com/page/129491/

  6. 【分享】Collecting all the cheat sheets

    http://overapi.com/   这个网站可以查询到所有与编程相关的各种技术,并给出详细的知识点(干货).

  7. VS2008 调试出现错误 "Unable to start debugging."

    之前用的好好的调试功能,今天“F5”出现了 "Unable to start debugging." 的错误: 解决办法: 打开工程属性,选择“Debugging”,看看“Debu ...

  8. 设计模式之简单工厂模式(Simply Factory)摘录

    从设计模式的类型上来说,简单工厂模式是属于创建型模式,又叫静态工厂方法(Static Factory Method)模式.但不属于23种GOF设计模式之中的一个.简单工厂模式是由一个工厂对象决定创建出 ...

  9. cocos2d游戏开发,常用工具集合

    位图字体工具Bitmap Font ToolsBMFont (Windows)FonteditorGlyph DesignerHieroLabelAtlasCreator 粒子编辑工具Particle ...

  10. 170120、java 如何在pdf中生成表格

    1.目标 在pdf中生成一个可变表头的表格,并向其中填充数据.通过泛型动态的生成表头,通过反射动态获取实体类(我这里是User)的get方法动态获得数据,从而达到动态生成表格. 每天生成一个文件夹存储 ...