Answers for "How do I sort a list of dictionaries by a value of the dictionary? js"

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
5

how to sort a list in python using lambda

data = [("Apples", 5, "20"), ("Pears", 1, "5"), ("Oranges", 6, "10")]

data.sort(key=lambda x:x[0])
print(data)
OUTPUT
[('Apples', 5, '20'), ('Oranges', 6, '10'), ('Pears', 1, '5')]

from kite.com
^^
Posted by: Guest on November-07-2020

Code answers related to "How do I sort a list of dictionaries by a value of the dictionary? js"

Python Answers by Framework

Browse Popular Code Answers by Language