Sort lines in a text file

Daniel no at no.no
Sun Jul 22 15:44:08 CEST 2007


On Sun, 22 Jul 2007 06:03:17 +0300, leegold <goldtech at worldpost.com> wrote:
> say I have a text file:
>
> zz3 uaa4a ss 7 uu
>   zz 3 zzzz66 ppazz9
> aaaaaaaaa00000zz0
>
> 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.

Do your own homework.



More information about the Python-list mailing list