[Solved] Dictionary Sorting based on lower dictionary value


raw = [{'Name': 'Erica','Value':12},{'Name':'Sam','Value':8},{'Name':'Joe','Value':60}]

raw.sort(key=lambda d: d['Value'], reverse=True)

result = []
for i in range(2):
    result.append(raw[i]['Name'])

print(result) # => ['Joe', 'Erica']

print(result)

Try this.

2

solved Dictionary Sorting based on lower dictionary value