[Tutor] substituting with a group

Paul Tremblay phthenry@earthlink.net
Mon, 8 Jul 2002 00:35:55 -0400


Given the following line:

{the quick {brown fox"

I want to produce the following line:

<the> quick <brown> fox

I know that in perl, you use an expression like this:

$string =~ s/\{(\w+)/<$1>/g;

In other words, I want to substitute using the group generated
from the search. How do you do this in python?

(Core Python didn't give me any hint.)

Thanks! 

Paul



-- 

************************
*Paul Tremblay         *
*phthenry@earthlink.net*
************************