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的更多相关文章

  1. 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', '')) > ...

  2. python"TypeError: 'NoneType' object is not iterable"错误解析

    尊重原创博主,原文链接:https://blog.csdn.net/dataspark/article/details/9953225 [解析] 一般是函数返回值为None,并被赋给了多个变量. 实例 ...

  3. 'NoneType' object is not iterable

    "TypeError: 'NoneType' object is not iterable" 一般是返回值为None同时赋值给了多个变量

  4. Python问题:'Nonetype' object is not iterable

    参考链接:http://blog.csdn.net/dataspark/article/details/9953225 [解析] 这个错误提示一般发生在将None赋给多个值时. [案例] 定义了如下的 ...

  5. TypeError: 'ExcelData' object is not iterable

    今天写了个测试的代码,结果在执行test_register.py文件在调用readexcle.py的时候一直报错TypeError: 'ExcelData' object is not iterabl ...

  6. TypeError: 'NoneType' object is not subscriptable

    运行,显示TypeError: 'NoneType' object is not subscriptable错误信息,原因是变量使用了系统内置的关键字list 重新定义下这个变量就好了

  7. TypeError: 'TestCase' object is not iterable

    这个异常呢其实是因为我对list没有足够熟悉 我一开始很疑惑,明明已经正确返回testcase对象了呀,为啥会报TypeError: 'TestCase' object is not iterable ...

  8. python报错Nonetype object is not iterable

    https://www.cnblogs.com/zhaijiahui/p/8391701.html 参考链接:http://blog.csdn.net/dataspark/article/detail ...

  9. Python : TypeError: 'int' object is not iterable

    用循环依次对list中的每个名字打印出 Hello, xxx! -------------------------------------------------------- L = ['Bart' ...

随机推荐

  1. angular2--Tour of Heroes学习和分析--路由

    引入路由模块时的一个报错 No base href set. Please provide a value for the APP_BASE_HREF token or add a base elem ...

  2. kafka安装教程

    今天需要在新机器上安装一个kafka集群,其实kafka我已经装了十个不止了,但是没有一个是为生产考虑的,因此比较汗颜,今天好好地把kafka的安装以及配置梳理一下: 1,kafka版本选取: 现在我 ...

  3. IAR Embedded Workbench for ARM 8.22.1 基础使用教程

    面向尚未熟悉且初次使用该软件的新手(比如我...) 1.建立新工作区 File-->>New Workspace 2.建立新项目 1) Project-->>Create Ne ...

  4. python locust 性能测试:HOOKS<钩子方法>

    为locust中不同类型的事件,提供的钩子方法: from locust import TaskSet, task, events, Locust from locust.clients import ...

  5. 原生JS实现表单序列化serialize()

    有一个form表单,要用AJAX后台提交,原来想拼接json,但是数据多了麻烦,不灵活. 用HTML5的FormData来初始化表单 var formdata=new FormData(documen ...

  6. AtomicReference

    public class AtomicReference<V> implements java.io.Serializable { private static final long se ...

  7. [WDS] Warnings while compiling. vue 项目运行控制台输出太多警告信息

    vue项目运行控制台输出太多警告信息,我们需要vue 忽略警告, 解决方法:找到build/webpack.base.conf.js  文件 注释掉: // ...(config.dev.useEsl ...

  8. 对于react-redux的理解

    一.redux与组件 React-Redux提供connect方法,用于从UI组件生成容器组件 二.react-redux的基本使用 1.引入 import {Provider} from " ...

  9. 网页静态化技术--Freemarker入门

    网页静态化技术:为什么要使用网页静态化技术 网页静态化解决方案在实际开发中运用比较多,例如新闻网站,门户网站中的新闻频道或者是文章类的频道. 对于电商网站的商品详细页来说,至少几百万个商品,每个商品又 ...

  10. domain

    babibobucecicudadedidufafugeguhehujijukakekulalelilumimomunapapipopuqiqurerirusasesisutatetituwawowu ...