当前位置:网站首页>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
边栏推荐
- Vulnstack3
- Exploration of short text analysis in the field of medical and health (II)
- Visual explanation of Newton iteration method
- Can you really learn 3DMAX modeling by self-study?
- Practice of tdengine in TCL air conditioning energy management platform
- Open source SPL optimized report application coping endlessly
- openresty ngx_ Lua execution phase
- 187. Repeated DNA sequence - with unordered_ Map basic content
- Restful fast request 2022.2.1 release, support curl import
- Talk about the things that must be paid attention to when interviewing programmers
猜你喜欢

MATLB | multi micro grid and distributed energy trading

spoon插入更新oracle数据库,插了一部分提示报错Assertion botch: negative time

Restful fast request 2022.2.1 release, support curl import

Asynchronous and promise

LeetCode 314. Binary tree vertical order traversal - Binary Tree Series Question 6

Open source SPL optimized report application coping endlessly

问题解决:AttributeError: ‘NoneType‘ object has no attribute ‘append‘

JVM - when multiple threads initialize the same class, only one thread is allowed to initialize

The perfect car for successful people: BMW X7! Superior performance, excellent comfort and safety
![[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?
随机推荐
Can you really learn 3DMAX modeling by self-study?
Application and development trend of image recognition technology
【LeetCode】110. Balanced binary tree (2 brushes of wrong questions)
Application and Optimization Practice of redis in vivo push platform
One click generation and conversion of markdown directory to word format
Win: use shadow mode to view the Desktop Session of a remote user
179. Maximum number - sort
Talk about the things that must be paid attention to when interviewing programmers
Win:将一般用户添加到 Local Admins 组中
Rabbit MQ message sending of vertx
Start the remedial work. Print the contents of the array using the pointer
[Yu Yue education] National Open University spring 2019 0505-22t basic nursing reference questions
[illumination du destin - 38]: Ghost Valley - chapitre 5 Flying clamp - one of the Warnings: There is a kind of killing called "hold Kill"
Codeforces Round #770 (Div. 2) ABC
Codeforces Global Round 19 ABC
How to make a cool ink screen electronic clock?
MATLB | multi micro grid and distributed energy trading
Icu4c 70 source code download and compilation (win10, vs2022)
openresty ngx_lua执行阶段
Write a thread pool by hand, and take you to learn the implementation principle of ThreadPoolExecutor thread pool