美文网首页
python提示AttributeError: 'NoneTyp

python提示AttributeError: 'NoneTyp

作者: 小毛驴上的路人甲 | 来源:发表于2018-01-11 12:41 被阅读0次

在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append'

self.alldata.append((elapsed_time, launched_time))

把a = a.append(b)改为a.append(b)后问题解决。

原因:append会修改a本身,并且返回None。不能把返回值再赋值给a。

相关文章

网友评论

      本文标题:python提示AttributeError: 'NoneTyp

      本文链接:https://www.haomeiwen.com/subject/fwvznxtx.html