How do I sort a list of dictionaries by a value of the dictionary?
I have a list of dictionaries and want each item to be sorted by a specific value.
Take into consideration the list:
[{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]
When sorted by name
, it should become:
[{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]