Let's say I have the following list.
foo = [["A", 1], ["B", 2], ["C", 1]]
I want to sort by the second element in the list, so I run the following.
foo.sort(key=lambda i: i[1])
Now, foo has the following order.
[['A', 1], ['C', 1], ['B', 2]]
Is there a good way to sort by the first element in the event that the second element in the list is equal? Say the order I want is the following.
[['C', 1], ['A', 1], ['B', 2]]