Python equivalent of Perl e flag with regular expression

skip at pobox.com skip at pobox.com
Thu Oct 2 16:03:42 EDT 2008


    Jason> With Perl I might do something like this:
    Jason> $line =~ s/(select)/uc($1)/e;
    ...
    Jason> How would I do this with Python?

I'm sure there are plenty of ways to skin this particular cat, but how is
's/.../.../e' different from 's/.../.../'?  (For those of us who are not
Perl mongers.)

Skip



More information about the Python-list mailing list