sort problem

Michele Petrazzo michele.petrazzo at
Thu Oct 20 18:13:48 CEST 2005

I have a list of lists (a grid table) that can have about 15000 - 20000
"rows" and 10 "cols", so:

1     [ [ 'aaa', 'vv', 'cc', 23, ... ],
2       [ 'aav', 'vv', 'cc', 45, ... ],
15000   [ 'sad', 'ad', 'es', 123, ... ], ]

I need to sort this list, but I need to specify two things: the "column"
and its type (string or int), so for example in this list, I want to
sort the fourth column that has int values. The type because that I want
that 1, 2, 12 will be sort in this order, not 1, 12, 2 like strings.

I have already tried to modify some code found on aspn, but the results
are always too slow for me, about 30-40 sec.
Can someone has some code or some point where can I start for speedup my


More information about the Python-list mailing list