问题 I have the dict in python in the following format: dict1 = [{'Name':'a', 'value':20},{'Name':'b', 'value':10},{'Name':'c', 'value':15}] I want output something like this: dict2 = {'a':20, 'b':10, 'c':15 } How to do it ? 回答1: I think you can do it with for loop efficiently. Check this: dict1 = [{'Name':'a', 'value':20},{'Name':'b', 'value':10},{'Name':'c', 'value':15}] dict2 = dict() for a in range(len(dict1)): dict2[dict1[a].get('Name')] = dict1[a].get('value') print(dict2) Output: {'a': 20,