xx = []
for i in range(-5, 10):
xx = xx.append(i)
print(xx)
以上代码,在运行后,报错如下:
Traceback (most recent call last):
File "D:\Python\Project\Retest\test.py", line 20, in <module>
xx = xx.append(i)
AttributeError: 'NoneType' object has no attribute 'append'
请问,list变量放到函数中不生效吗?