- 博客(1)
- 收藏
- 关注
原创 AttributeError: ‘NoneType‘ object has no attribute ‘append‘
python报错: AttributeError: ‘NoneType’ object has no attribute ‘append’ a=[] b=[1,2,3,4] a = a.append(b) 执行一次后发现a的类型变为了NoneType。 下次执行时就会出现上述的错误。 这是因为,append会修改a本身,并且返回None。不能把返回值再赋值给a。 解决办法: 改变变量名: c=[] b=[1,2,3,4] c = a.append(b) 问题解决。 或者 把a = a.append(b)改为
2021-05-31 20:34:00 293
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人