How Can I do vi-like substitutions?

Michel Huster mhuster_AT at hotmail_DOT.com
Thu Sep 30 20:49:19 EDT 1999


I want to do some complex replace inside python. I am used to vi power like:

s/\([0-9]*\) at \([0-9]*\)/\2 AT \1/

which will change
1234 at 5678
into
5678 AT 1234

I can only find re.sub(expr, repl, count) but this does not 'remember' the
saves matches between arguments.

Help!
¡Ayudame!

Michael Huster
mhuster_AT at hotmail_DOT.com

(remove _AT and _DOT to reply)




More information about the Python-list mailing list