Sorting strings.

Greg Jorgensen gregj at
Thu Feb 8 08:54:15 CET 2001

In article <4a1yt93frj.fsf at>,
  Gaute B Strokkenes <gs234 at> wrote:
> ...
> The problem with this approach is that string comparison doesn't quite
> have the behaviour that I would like.  For instance, I'd like numbers
> to come after letters, and I'd like to be case insensitive.  Is there
> a reasonably clean way to do this?

You can write a function to compare strings according to your rules:
ignore case, make the digits greater than letters, and (maybe) ignore
punctuation and anything else not alphanumeric. Then use that function
to compare author, title, etc. rather than <, ==, >.

Greg Jorgensen
Portland, Oregon, USA
gregj at

Sent via

More information about the Python-list mailing list