Python TypeError: ‘NoneType’ object has no attribute ‘append’ Solution

YU NA Joe·2022년 4월 12일
0

The Python append() method returns a None value.
This is because appending an item to a list updates an existing list. It does not create a new one.

nums = [1,2,3,4,5]

nums.append(10)

print(nums)  # [1, 2, 3, 4, 5, 10]



nums2 = [1,2,3,4,5]

new = nums2.append(10)

print(new)  # None


1개의 댓글

comment-user-thumbnail
2024년 2월 27일

Scattered phone calls, hidden messages, and newspaper clippings hint at a dark history behind the five nights at freddy's pizzeria.

답글 달기