Answers for "how to sort a list of dictionaries python"

14

sort list of dictionaries by key python

newlist = sorted(list_to_be_sorted, key=lambda k: k['name'])
Posted by: Guest on March-25-2020
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 "how to sort a list of dictionaries python"

Python Answers by Framework

Browse Popular Code Answers by Language