tricky sorting

les abidnego25 at yahoo.com
Mon Oct 14 22:46:04 CEST 2002


Hi,
suppose I have a list of following
##########################################
abdng  I    10-11
abdns  IV   43-45
rshts  I    1201-1210
qurst  XIII 87-98
..
andng  IX   18293-19283

etc
#################################
I would like to sort by two fields: first sort by the second column (which is in 
roman numerals) and then I would like to sort by the last column (only the "from"
part only) 
so the above result would be 
abdng I 10-11
rshts I 1201-1210
abdns IV 43-45
qurst XIII 87-98
andng IX  18293-19283

I can do this in C with a compare function but i don't know how
to write this special compare function in python. 
can some one help me do this ? thanks



More information about the Python-list mailing list