python提示AttributeError: 'NoneType' object has no attribute 'append'

I encountered AttributeError when writing a python script: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.append(b) After executing it once, it was found that the type of a changed for NoneType. The error shown in the title will appear the next time it is executed. The problem is solved after changing a = a.append(b) to a.append(b). Reason: append modifies a itself and returns None. The return value cannot be reassigned to a.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325476073&siteId=291194637