Answers for "sort a list of dictionaries by value"

3

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"])
Posted by: Guest on December-13-2020

Code answers related to "sort a list of dictionaries by value"

Python Answers by Framework

Browse Popular Code Answers by Language