[Tutor] set key to sort

prasad rao prasadaraon50 at gmail.com
Sat Jan 31 10:51:59 CET 2009


hellI got a problem sorting a list of lists.

ml=
[[112, 'p'], [114, 'r'], [97, 'a'], [115, 's'], [97, 'a'], [100, 'd'], [97,
'a'], [114, 'r'], [97, 'a'], [111, 'o']]
sorted(ml,key=?)
How can I formulate a key to sort based on the first element of each list.

sorting list of lists might have been discussed in the resent past.
Is there a repository of all threads of this list on the web.


thank you

prasad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090131/b26841e7/attachment.htm>


More information about the Tutor mailing list