5th
12:56: When you need to sort a list by a specific key in each list-item’s object, you use a lambda function to drill down to your key.1
example = [
("event": "A walk in the woods", "date": datetime_object_1),
("event": "Grocery Shopping", "date": datetime_object_2),
("event": "Movie Night")
]
example.sort(key=lambda example: example["date"])
Read other posts