backslash plague: paths containing "\a" somewhere

Fredrik Lundh fredrik at pythonware.com
Thu Nov 24 12:00:32 EST 2005


"tim" <tim.vets at skynet.be> wrote:

> trying to work with a directory in windows, that has "\a" in the full
> pathname
>
> this works:
>
>  >>> c = string.replace('c:\content\ce\cw\cvd', '\\', '\\')
>  >>> c
> 'c:\\content\\ce\\cw\\cvd'
>
> this doesn't:
>
>  >>> c = string.replace('c:\content\a\a\avd', '\\', '\\')
>  >>> c
> 'c:\\content\x07\x07\x07vd'
>
> same goes for paths containing "\b"
>
> what's the workaround?

reading up on how string literals work might help:

http://www.python.org/doc/current/tut/node5.html#SECTION005120000000000000000
http://www.python.org/doc/current/ref/strings.html

</F>






More information about the Python-list mailing list