following on from this question
i have the following lists in python which i want to recombine into a dictionary/list:
from
fromfruits = { "names" : ['banana','grapefruit','apple'] , "colors" : ['yellow','pink','green'], ... }
to
tofruits = [
{'name':'banana','color':'yellow',...},
{'name':'grapefruit','color':'pink',...},
{'name':'apple','color':'green',...}
]
what’s the best way to do it so that i can have n properties listed in fromfruits?
please help! 🙂
Since the request is now to be more general:
since the order of
keysandvaluesare the same (assuming no intervening modifications to the dictionary).