Sort lines in a text file

leegold goldtech at
Sun Jul 22 05:03:17 CEST 2007

say I have a text file:

zz3 uaa4a ss 7 uu
  zz 3 zzzz66 ppazz9

I want to sort the text file. I want the key to be the number after
the two "zz".  Or I guess a string of two zz then a number....So
that's 3, 9, 0

I'm trying to say that I want to sort lines in a file based on a
regular expression. How could I do that in Python? I'm limited to
Python 2.1, I can't add any 2nd party newer tools.

Lee G.

More information about the Python-list mailing list