Raw strings and escaping

Fredrik Lundh fredrik at pythonware.com
Tue Oct 3 14:21:33 CEST 2006

Matthew Warren wrote:

> I would expect this to work,
> rawstring=r'some things\new things\some other things\'
> But it fails as the last backslash escapes the single quote.

raw string literals are parsed in exactly the same way as ordinary string literals; it's
just the mapping from the string literal to the contents of the string object that differs.

see the documentation for details.


More information about the Python-list mailing list