Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

sort list of dictionaries python

unsorted_list = [{"key1":5, "key2":2}, {"key1":5, "key2":1}]
sorted_list = sorted(unsorted_list, key=lambda k: k["key2"])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #sort #list #dictionaries #python
ADD COMMENT
Topic
Name
6+8 =