sorting a list of lists

iapain iapain at gmail.com
Mon Aug 27 13:21:07 EDT 2007


> i would like to sort a list of lists. The list is first sorted on the
> second item in the sub-lists (which I can do), then on the third item
> (which I can't).

Write a comparator instead of dirty hacks

mylistoflist.sort(mycomparator)

def mycomparator(a, b):
  #do





More information about the Python-list mailing list