Python - List


Sorting

In-Place
a.sort()
New List
new_a = sorted(a)
Key Functions

Works with both in-place and sorted

a = [('a', 1), ('c', 3), ('b', 2)]
a.sort(key=lambda x: x[1])