How can I efficiently and easily sort a list of tuples without being case sensitive?
For instance:
[('a', 'c'), ('A', 'b'), ('a', 'a'), ('a', 5)]
Should look like once sorted:
[('a', 5), ('a', 'a'), ('A', 'b'), ('a', 'c')]
Regular lexicographic sorting will place 'A' in front of 'a' and give the following:
[('A', 'b'), ('a', 5), ('a', 'a'), ('a', 'c')]
source
share