1
朋友,基本上,我想帶一個字典:由具有不同密鑰的所有值之間的所有可能的排列如何從字典中的每個值列表中選擇一個項目的所有排列?
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'}
]
怎麼做?太感謝了!
非常感謝,AGF!按需要工作。 –