Case-Insensitive Sorting of Multi-Dimensional Lists

Joe joe at incomps.com
Thu Jun 7 17:41:48 EDT 2007


I have a list of lists that I would like to sort utilizing a certain index
of the nested list.  I am able to successfully use:

 

Import operator

list = [["Apple", 1], ["airplane", 2]]

list.sort(key=operator.itemgetter(0))

 

But, unfortunately, this will be case sensitive (Apple will come before
airplane because the A is capital) and I need it to be insensitive.  

 

Can someone provide some input, please?

 

Thanks in advance!

 

Jough

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070607/848aebaa/attachment.html>


More information about the Python-list mailing list