将列表的所有值都放到另一个列表中

时间:2016-03-12 21:31:54

标签: python-3.x

如果我有一个清单:

list = [{'duration': 19.8489379882812, 'enterZoneVelocity': 1254, 'averageVelocity': 815, 'leaveZoneVelocity': 414}]

和另一个清单:

2ndList = [249.2021]

我怎样才能成功

3rdList = [249.2021, 19.8489379882812, 1254, 815, 414]

我用

尝试了
for x in list:
    2ndList.append(x)

但遗憾的是没有工作

1 个答案:

答案 0 :(得分:0)

试试这个:

third_list = second_list + list(first_list[0].values())

您正在获取第一个列表中的字典值,将其转换为列表并预先添加第二个列表。