Sort a list of tuples without case sensitivity
Posted
by dound
on Stack Overflow
See other posts from Stack Overflow
or by dound
Published on 2010-03-22T18:26:30Z
Indexed on
2010/03/22
18:31 UTC
Read the original article
Hit count: 316
How can I efficiently and easily sort a list of tuples without being sensitive to case?
For example this:
[('a', 'c'), ('A', 'b'), ('a', 'a'), ('a', 5)]
Should look like this once sorted:
[('a', 5), ('a', 'a'), ('A', 'b'), ('a', 'c')]
The regular lexicographic sort will put 'A' before 'a' and yield this:
[('A', 'b'), ('a', 5), ('a', 'a'), ('a', 'c')]
© Stack Overflow or respective owner