a.sort()
new_a = sorted(a)
Works with both in-place and sorted
a = [('a', 1), ('c', 3), ('b', 2)] a.sort(key=lambda x: x[1])