append导致TypeError: 'NoneType' object is not iterable
a=[1,2,3]
a.append(4)
a
Out[4]: [1, 2, 3, 4]
a=a.append(5)
print(a)
None
a =[1,2,3]
print(a.append(4))
None
a
Out[10]: [1, 2, 3, 4]
因为:
描述
append() 方法用于在列表末尾添加新的对象。
语法
append()方法语法:
list.append(obj)
参数
- obj -- 添加到列表末尾的对象。
返回值
该方法无返回值,但是会修改原来的列表。
------------------------
当一个函数没有return语句,函数会返回None,此时如果将函数返回值赋给多个变量,则容易出现上述错误。
append导致TypeError: 'NoneType' object is not iterable的更多相关文章
- python TypeError: 'NoneType' object is not iterable
list(set(map(lambda tp_id : tp_id if not ('#' in tp_id) and len(tp_id.strip().replace('\n', '')) > ...
- python"TypeError: 'NoneType' object is not iterable"错误解析
尊重原创博主,原文链接:https://blog.csdn.net/dataspark/article/details/9953225 [解析] 一般是函数返回值为None,并被赋给了多个变量. 实例 ...
- 'NoneType' object is not iterable
"TypeError: 'NoneType' object is not iterable" 一般是返回值为None同时赋值给了多个变量
- Python问题:'Nonetype' object is not iterable
参考链接:http://blog.csdn.net/dataspark/article/details/9953225 [解析] 这个错误提示一般发生在将None赋给多个值时. [案例] 定义了如下的 ...
- TypeError: 'ExcelData' object is not iterable
今天写了个测试的代码,结果在执行test_register.py文件在调用readexcle.py的时候一直报错TypeError: 'ExcelData' object is not iterabl ...
- TypeError: 'NoneType' object is not subscriptable
运行,显示TypeError: 'NoneType' object is not subscriptable错误信息,原因是变量使用了系统内置的关键字list 重新定义下这个变量就好了
- TypeError: 'TestCase' object is not iterable
这个异常呢其实是因为我对list没有足够熟悉 我一开始很疑惑,明明已经正确返回testcase对象了呀,为啥会报TypeError: 'TestCase' object is not iterable ...
- python报错Nonetype object is not iterable
https://www.cnblogs.com/zhaijiahui/p/8391701.html 参考链接:http://blog.csdn.net/dataspark/article/detail ...
- Python : TypeError: 'int' object is not iterable
用循环依次对list中的每个名字打印出 Hello, xxx! -------------------------------------------------------- L = ['Bart' ...
随机推荐
- Spring Boot:快速入门(二)
学习完成怎么搭建一个独立Spring Boot项目后,上面是整理出来的一些相关文件以及用途. 原本是一个Excel文件,拷贝到博客园就成了图片,当做几个笔记了,用到的时候可以查阅,也欢迎转载,收藏. ...
- MAVEN简介之——pom.xml
maven构建的生命周期 maven是围绕着构建生命周期这个核心概念为基础的.maven里有3个内嵌的构建生命周期,default,clean和site. default是处理你项目部署的:clean ...
- 单链表反转java代码
据说单链表反转问题面试中经常问,而链表这个东西相对于数组的确稍微难想象,因此今天纪录一下单链表反转的代码. 1,先定义一个节点类. public class Node { int index; Nod ...
- Oracle 体系结构chapter2
前言:Oracle 体系结构其实就是指oracle 服务器的体系结构,数据库服务器主要由三个部分组成 管理数据库的各种软件工具(sqlplus,OEM等),实例(一组oracle 后台进程以及服务器中 ...
- 福州大学软件工程1916|W班 第5次作业成绩排名
1. 作业链接: https://edu.cnblogs.com/campus/fzu/SoftwareEngineering1916W/homework/2768 2. 评分准则: 本次作业评分分为 ...
- 【转】数据处理常用的sql语句整理
一下语句都是基于 mysql数据库 查询是否使用索引 explain select * FROM t_table1; 结果列的含义: table:此次查询操作是关联哪张数据表 type:连接查询操作 ...
- racle SQL性能优化
(1) 选择最有效率的表名顺序(只在基于规则的优化器中有效): Oracle的解析器按照从右到左的顺序处理FROM子句中的表名,FROM子句中写在最后的表(基础表 driving table)将被最先 ...
- An owner of this repository has limited the ability to open a pull request to users that are collaborators on this repository.
git 无法发起:pull request,提示:An owner of this repository has limited the ability to open a pull request ...
- Java面试题整理---网络篇
1.BIO.AIO和NIO的概念及区别? 2.什么是长连接和短连接? 3.http1.0.http1.1和http2.0的区别? 4.https和http的区别? 5.https的工作原理? ...
- 手机APP应用外网访问本地WEB应用
手机APP应用外网访问本地WEB应用 本地安装了WEB服务端,手机APP应用只能在局域网内访问本地WEB,怎样使手机APP应用从公网也能访问本地WEB? 本文将介绍具体的实现步骤. 1. 准备工作 1 ...