list sort question

Bill Tolbert coolbill at my-deja.com
Fri Oct 6 20:35:25 EDT 2000


I was asked today to sort a list of names and email addresses by last
name. I ended up with a list of tuples:

[('Bill Tolbert', 'bill_tolbert at bigfoot.com'), ('Tom Hogan',
'TH at bigfoot.com'), ('Test Zebra', 'tz at email.com'), ('Three Level Name',
'tln at email.com')]

I couldn't figure out the list.sort(somefunction) syntax and resorted to
all sorts of slicing before I gave up and solved it in a query (outside
of Python).

Any ideas on how to solve such a problem?

Thanks,

Bill Tolbert


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list