When does the escape character work within raw strings?

walterbyrd walterbyrd at iname.com
Fri May 22 10:47:49 EDT 2009


On May 21, 9:44 pm, "Rhodri James" <rho... at wildebst.demon.co.uk>
wrote:

> Escaping the delimiting quote is the *one* time backslashes have a
> special meaning in raw string literals.

If that were true, then wouldn't r'\b' be treated as two characters?

> This calls re.sub with a pattern string object that contains two
> characters, a backslash followed by an 'n'.  This combination *does*
> have a special meaning to the sub function, which does it's own
> translation of the pattern into a single newline character.  

So when do I know when a raw string is treated as a raw string, and
when it's not?



More information about the Python-list mailing list