Tag Archives: Python beginner

[2021-10-05] Python Error: AttributeError: ‘NoneType‘ object has no attribute ‘append‘

Traceback (most recent call last):
File “D:\C world\py\实验03.py”, line 36, in <module>
APPEND=APPEND.append(random.randint(1,100000))
AttributeError: ‘NoneType’ object has no attribute ‘append’

Change APPEND=APPEND.append(random.randint(1,100000)) to

APPEND=APPEND.append(random.randint(1,100000))
#Wrong
    
APPEND.append(random.randint(1,100000))
#Right

alike

print(a.reverse)
#Wrong
a=a.reverse
#Wrong

a.reverse
print(a)
#Right