more on unescaping escapes

Mel mwilson at
Tue Feb 24 02:03:28 CET 2009

bvdp wrote:
> Not sure if it's more clear or not :)
>  >>> a="c:\\Program\x20Files\\test"
>  >>> a
> 'c:\\Program Files\\test'
>  >>> print a
> c:\Program Files\test
> Which is all fine. And I didn't need to use decode().
> So, in this case I'm assuming that the interpreter is converting the
> escapes on assignment. And, in this case the string has single \s in it.

Strictly speaking, the compiler is converting the escapes when it uses the
literal to create a string value.


More information about the Python-list mailing list