home
to by nando.quintana
# sort by first element
# if the are equal, compare second element of the tuplas (as integers)
# if seconds elements are equal, compare second element of the tuplas (as integers)
results = ( ('a',1,3), ('j',6,7), ('b',4,5), ('g',3,2), ('c',6,9) )
results.sort( lambda x,y: cmp( str(x[0]), str(y[0]) ) or cmp(int(y[1]),int(x[1])) or cmp( int(y[2]), int(x[2])) )to by nando.quintana
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.