如何从MaterialGroupMaster对象创建元组

时间:2013-12-03 11:55:44

标签: python

我有这样的数据结构:

[<MaterialGroupMaster: test>, <MaterialGroupMaster: test  material>, <MaterialGroupMaster: last>]

我如何得到如下内容?

('test','test  material','last')

1 个答案:

答案 0 :(得分:0)

您没有字典列表,而是拥有自定义类的实例列表。

要将每个属性中的特定属性提取到元组中,请使用:

tuple(ob.attribute for ob in inputlist)
相关问题