在写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。

转载于:https://www.cnblogs.com/z-x-y/p/9000304.html

python提示AttributeError: 'NoneType' object has no attribute 'append'相关推荐

  1. Python 中 AttributeError: ‘NoneType‘ object has no attribute ‘X‘ 错误

    文章目录 AttributeError: 'NoneType' object has no attribute 'X' 介绍 AttributeError: 'NoneType' object has ...

  2. 解决python爬虫AttributeError: ‘NoneType‘ object has no attribute ‘find_all‘

    网页上异地加密数据的python爬虫 这里特别感谢钟思哲大佬帮我找到了问题并帮助解决 要搞python大作业 想从https://www.endata.com.cn/BoxOffice/BO/Year ...

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

  4. Python学习笔记:‘’AttributeError: NoneType object has no attribute‘’

    前言 最近在学习python,犯了很多低级错误,总结一下 目录 文章目录 前言 目录 问题 出处 方案 问题 AttributeError: 'NoneType' object has no attr ...

  5. python爬虫数据寻找过程(解决爬虫异步导致AttributeError: 'NoneType' object has no attribute 'find_all'错误)

    前边写了url的分析 我们爬取想要的数据,一般是打开网站链接,用浏览器的elements功能对网页标签进行数据分析,确定想要的数据的位置,再在代码中通过requests库的get和post方式发起请求 ...

  6. AttributeError: 'NoneType' object has no attribute 'grid'报错解决方案

    1问题描述: 当我们在使用tkinter时经常遇到AttributeError: 'NoneType' object has no attribute 'grid'的报错 2.原因分析: import ...

  7. Keras问题“AttributeError: 'NoneType' object has no attribute 'update”解决

    BUG 在使用Keras训练模型时,在每个epoch完成后save_model时会报错 "AttributeError: 'NoneType' object has no attribute ...

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

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

  9. Pywinauto 应用后端类型选择错误:AttributeError: ‘NoneType‘ object has no attribute ‘backend‘. 原因及解决办法

    AttributeError: 'NoneType' object has no attribute 'backend'. 错误原因: 选择的应用后端类型不对. windows 上应用的后端类型有两种 ...

  10. 成功解决AttributeError: 'NoneType' object has no attribute '__array_interface__'

    成功解决AttributeError: 'NoneType' object has no attribute '__array_interface__' 目录 解决问题 解决思路 解决方法 原因及思路 ...

最新文章

  1. [JS] undefined、null、ReferenceError的区别、变量作用域问题
  2. Python基础实战之函数的参数讲解(三)
  3. java 取字段_java – 获取字段的名称
  4. 列联表相关测量--φ列相关系数
  5. WORD文档中的表格:自定义方式的批处理,增删行列和内容
  6. 数组初始化 和 vector初始化
  7. 韩泰机器人_[视频]Hankook Mirae展示四米高的Method-2载人两足机器人
  8. maven deploy distributionManagement
  9. mysql 页面跳转_Springboot+MyBatis+mysql+jsp页面跳转详细示例
  10. 【LeetCode】【HOT】101. 对称二叉树(BFS+队列/递归)
  11. [转载] 机器学习之主成分分析PCA(Python实现)
  12. Python实现google翻译
  13. 极限中0除以常数_谈用泰勒展开法求极限
  14. 北京药监局考试计算机操作,考科一电脑操作
  15. HNOI2014 世界树 基于虚树的树形动态规划
  16. 灵遁者是散文:不可理解的痛
  17. 那些年,和女孩们同居的日子
  18. ASP.NET教师排课系统
  19. sublime text 打开总是弹框报错Unable to download XXX. Please view the console for more details.解决办法
  20. 纯shell实现文本替换

热门文章

  1. IDEA给项目添加lib/jar
  2. 文本文件中,如何判断有效换行?
  3. 编译问题解决:mkdir: 无法创建目录/usr/local/share/man/man1: 文件已存在
  4. ubuntu 查找opencv安装路径_Ubuntu系统---配置OpenCV
  5. 计算机编程 设计入门,计算机编程入门图文教程_计算机程序设计教程,计算机编程入门教程-其它文档类资源...
  6. axios 同时多个请求_Axios是什么?用在什么场景?如何使用?
  7. 谈谈计算机专业职业技能,计算机专业职业技能论文
  8. python视频网站项目_Python项目04 视频网站数据清洗整理和结论研究
  9. multiprocessing.queue取数据要加锁么_秒杀抢购思路以及高并发下数据安全
  10. BOOST库介绍(五)——智能指针shared_ptr