当前位置:网站首页>Problem solving: attributeerror: 'nonetype' object has no attribute 'append‘
Problem solving: attributeerror: 'nonetype' object has no attribute 'append‘
2022-07-05 02:22:00 【Gongzicong】
python Medium append() Method is used for Add a new object at the end of the list .
The method No return value ( That is, the return value is null ), however Will modify the original list .
a = [1, 2, 3]
b = a.append(4)
print(a) # [1, 2, 3, 4]
print(b) # NoneIt can be seen from the result execution ,append() no return value (b The value of is empty ), So if b Add a new object on , namely :
b.append(5) An error will be reported after execution AttributeError: 'NoneType' object has no attribute 'append'
because b It's an empty type , Not a list type , So there was no append() Method , Here should be b.append(5) It is amended as follows a.append(5)
Summary :
append() Method is used to add a new object at the end of the list , no return value , But it changes the original list .
therefore , In the use of append() When the method is used , You cannot assign its execution result to other variables before viewing or other operations .
Reference material :
https://www.runoob.com/python/att-list-append.html
https://blog.csdn.net/weixin_44249185/article/details/102580621
边栏推荐
- Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
- Leetcode takes out the least number of magic beans
- 【附源码】基于知识图谱的智能推荐系统-Sylvie小兔
- PowerShell: use PowerShell behind the proxy server
- Vulnstack3
- Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool
- Kotlin - 协程 Coroutine
- Unified blog writing environment
- RichView TRVUnits 图像显示单位
- Variables in postman
猜你喜欢

Application and Optimization Practice of redis in vivo push platform
![[download white paper] does your customer relationship management (CRM) really](/img/e3/f130d071afb7309fdbf8a9c65b1d38.jpg)
[download white paper] does your customer relationship management (CRM) really "manage" customers?

Li Kou Jianzhi offer -- binary tree chapter

问题解决:AttributeError: ‘NoneType‘ object has no attribute ‘append‘
![[technology development-26]: data security of new information and communication networks](/img/13/10c8bd340017c6516edef41cd3bf6f.png)
[technology development-26]: data security of new information and communication networks

The steering wheel can be turned for one and a half turns. Is there any difference between it and two turns

A label making navigation bar

Application and Optimization Practice of redis in vivo push platform

Introduce reflow & repaint, and how to optimize it?
![[Digital IC hand tearing code] Verilog edge detection circuit (rising edge, falling edge, double edge) | topic | principle | design | simulation](/img/9e/4c8557bb4b75b1e74598dedb24af86.jpg)
[Digital IC hand tearing code] Verilog edge detection circuit (rising edge, falling edge, double edge) | topic | principle | design | simulation
随机推荐
Mysql database | build master-slave instances of mysql-8.0 or above based on docker
Stored procedure and stored function in Oracle
Action News
Talk about the things that must be paid attention to when interviewing programmers
Visual explanation of Newton iteration method
丸子百度小程序详细配置教程,审核通过。
Rabbit MQ message sending of vertx
Numpy library introductory tutorial: basic knowledge summary
Grpc message sending of vertx
[understanding of opportunity -38]: Guiguzi - Chapter 5 flying clamp - warning one: there is a kind of killing called "killing"
[uc/os-iii] chapter 1.2.3.4 understanding RTOS
Pytorch fine tuning (Fortune): hollowed out design or cheating
Outlook: always prompt for user password
A label colorful navigation bar
Limited query of common SQL operations
Interpretation of mask RCNN paper
Word processing software
Educational Codeforces Round 122 (Rated for Div. 2) ABC
如何做一个炫酷的墨水屏电子钟?
Which common ports should the server open