繁体   English   中英

TypeError: append() 没有关键字参数

[英]TypeError: append() takes no keyword arguments

我真的是 Python 的初学者,我正在做一个项目,我必须提取建筑物的所有元素。 为此,我编写了代码:

import ifcopenshell.geom
import ifcopenshell.util
from ifcopenshell.util.selector import Selector
selector = Selector()
import ifcopenshell.util.element as util
import pandas as pd
import ifcopenshell
ifc = ifcopenshell.open('FHZGR_PONTE DELL`ACCADEMIA_PH01_BEM.ifc')
ifc

接着:

elements = selector.parse(ifc, '.IfcWall | .IfcSlab | .IfcWindow | .IfcDoor | .IfcRamp | .IfcColumn | .IfcBeam | .IfcStair')
elements

然后:

l = []
for element in elements:
    l.append(elements, columns = ['Klasse', 'Typ', 'Objekt', 'ID'])
l
df = pd.DataFrame(l)
df

但最后的代码行返回给我:

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Input In [17], in <cell line: 2>()
      1 l = []
      2 for element in elements:
----> 3     l.append(elements, columns = ['Klasse', 'Typ', 'Objekt', 'ID'])
      4 l
      5 df = pd.DataFrame(l)

TypeError: append() takes no keyword arguments

有人可以帮忙解决问题吗?

您要追加到列表中,唯一的参数append将元素追加到列表中。

l = []
for element in elements:
    l.append(element)

请参阅有关可变序列类型(包括list的文档。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM