Asked • 05/27/19

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 property values.Take into consideration the array below, [{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]When sorted by `name`, should become [{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]

1 Expert Answer

By:

Brandon T. answered • 05/28/19

Tutor
5.0 (42)

Python Expert

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.