tricky sorting

Mark McEahern marklists at mceahern.com
Mon Oct 14 17:12:04 EDT 2002


[les]
> 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

Um, but doesn't XIII come before IX?  <wink>

Mark Pilgrim implemented a nice roman numeral library in his book Dive Into
Python (http://www.diveintopython.org/). Look at the chapter on unit
testing.  The code is available there.  Jeff Epler's reply has all the rest
of the suggestions I would have made--but his post is more explicit than
mine would have been.  <wink>

Cheers,

// mark

-





More information about the Python-list mailing list