float object has no attribute 'append'

在python的编程开发过程中,python抛出float object has no attribute 'append'的AttributeError,其大意就是python的float类型的对象没有append属性或方法,即float对象无法调用append()方法,而且append()方法只能被列表list对象调用,可参考python源码对该方法的介绍,如下:

append(self, object, /)
    Append object to the end of the list.

意思是append()可以将python object对象添加到列表list的末尾。

python全栈:笨鸟工具,python全栈

append()方法的用法实例

>>> a = []
>>> a.append('abc')
>>> a
['abc']
>>> a.append('def')
>>> a
['abc', 'def']

原文地址:float object has no attribute 'append'

Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐