【发布时间】:2012-12-27 02:55:52
【问题描述】:
朋友们,基本上,我想听听听写:
fruit_dict = {'oranges':['big','small'],'apples':['green','yellow','red']}
并通过在不同键的所有值之间进行所有可能的排列来获得以下字典列表:
output_list =
[
{'oranges':'big','apples':'green'},
{'oranges':'big','apples':'yellow'},
{'oranges':'big','apples':'red'},
{'oranges':'small','apples':'green'},
{'oranges':'small','apples':'yellow'},
{'oranges':'small','apples':'red'}
]
怎么做?谢谢一百万!
【问题讨论】:
标签: python list dictionary permutation