Raw string substitution problem
Rhodri James
rhodri at wildebst.demon.co.uk
Sat Dec 19 19:07:02 EST 2009
More information about the Python-list mailing list
Sat Dec 19 19:07:02 EST 2009
- Previous message (by thread): Raw string substitution problem
- Next message (by thread): Raw string substitution problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Fri, 18 Dec 2009 17:58:08 -0000, Alan G Isaac <alan.isaac at gmail.com> wrote: > 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? So that the substitution escapes \1, \2 and so on work. -- Rhodri James *-* Wildebeeste Herder to the Masses
- Previous message (by thread): Raw string substitution problem
- Next message (by thread): Raw string substitution problem
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list