In Python how do I sort a list of dictionaries by values of the dictionary?

Posted by masi on Stack Overflow See other posts from Stack Overflow or by masi
Published on 2008-09-16T14:27:47Z Indexed on 2010/05/18 15:40 UTC
Read the original article Hit count: 490

Filed under:
|
|
|

I got a list of dictionaries and want that to be sorted by a value of that dictionary.

This

[{'name':'Homer', 'age':39}, {'name':'Bart', 'age':10}]

sorted by name, should become

[{'name':'Bart', 'age':10}, {'name':'Homer', 'age':39}]

© Stack Overflow or respective owner

Related posts about python

Related posts about sorting