Raw string substitution problem
Alan G Isaac
alan.isaac at gmail.com
Fri Dec 18 12:58:08 EST 2009
On 12/17/2009 7:59 PM, Rhodri James wrote:
> "re.compile('a\\nc')" passes a sequence of four characters to
> re.compile: 'a', '\', 'n' and 'c'. re.compile() then does it's own
> interpretation: 'a' passes through as is, '\' flags an escape which
> combined with 'n' produces the newline character (0x0a), and 'c' passes
> through as is.
I got that from MRAB's posts. (Thanks.)
What I'm not getting is why the replacement string
gets this particular interpretation. What is the payoff?
(Contrast e.g. Vim's substitution syntax.)
Thanks,
Alan
More information about the Python-list
mailing list