I have the dict in python in the following format:
dict1 = [{\'Name\':\'a\', \'value\':20},{\'Name\':\'b\', \'value\':10},{\'Name\':\'c\', \'value\':15}]
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, 'b': 10, 'c': 15}
This is the easy way:
dict1 = [{'Name':'a', 'value':20},{'Name':'b', 'value':10},{'Name':'c', 'value':15}]
dict2={dc['Name']:dc['value'] for dc in dict1}