Raw string substitution problem

MRAB python at mrabarnett.plus.com
Fri Dec 18 21:24:00 EST 2009


Gregory Ewing wrote:
> MRAB wrote:
> 
>> In simple cases you might be replacing with the same string every
>> time, but other cases you might want the replacement to contain
>> substrings captured by the regex.
> 
> But you can give it a function that has access to the match object
> and can produce whatever replacement string it wants.
> 
> You already have a complete programming language at your disposal.
> There's no need to invent yet another mini-language for the
> replacement string.
> 
There's no need for list comprehensions either, but they're much-used
shorthand.



More information about the Python-list mailing list