Let's say I have a list of lists l == [[1, 2, 3], [2, 3, 1], [3, 2, 1], [1, 3, 2]]

If I do a l.sort(), it sorts on the first element of each listed list:

>>> l.sort()
>>> l
[[1, 2, 3], [1, 3, 2], [2, 3, 1], [3, 2, 1]]


How can I sort on the second or third elements of the listed lists?

Keith

A++ G++ PKR+ !PEG- B++ TB ADB- M+++ CHOW++
http://zbigniew.pyrzqxgl.com/bargegeek.html


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to