【发布时间】:2019-04-06 17:27:14
【问题描述】:
考虑以下list 或dict。
food = [{'pizza': 324}, {'sandwich': 78}, {'hot dog': 90}]
我怎样才能将键和值分开为lists;
[pizza, sandwich, hot dog]
[324,78,90]
【问题讨论】:
-
为什么有字典列表?字典已经是项目的集合,所以如果你有它肯定会更容易。
标签: python-3.x list dictionary key