Raw strings and escaping

Rob Williscroft rtw at freenet.co.uk
Tue Oct 3 13:06:05 CEST 2006


Matthew Warren wrote in news:mailman.1152.1159872720.10491.python-
list at python.org in comp.lang.python:

> I would expect this to work,
> 
> rawstring=r'some things\new things\some other things\'

It in the docs:

<url:http://docs.python.org/ref/strings.html#l2h-14>

...  Specifically, a raw string cannot end in a single backslash (since the 
backslash would escape the following quote character). Note also that a 
single backslash followed by a newline is interpreted as those two 
characters as part of the string, not as a line continuation. 

Rob.



More information about the Python-list mailing list