open filename with spaces in path
A.T.Hofkamp
hat at se-162.se.wtb.tue.nl
Wed May 7 09:25:27 EDT 2008
On 2008-05-07, Chris <cwitts at gmail.com> wrote:
>>>> os.chdir('C:\temp\my test')
> Traceback (most recent call last):
> File "<input>", line 1, in <module>
> WindowsError: [Error 123] The filename, directory name, or volume
> label syntax is incorrect: 'C:\temp\\my test'
Python strings have \ escapes, such as \t, \n etc. Above you try to go to
C:<TAB>emp\my test
and you are lucky that \m is not something special.
Either escape your back slashes ("C:\\temp\\my test") or use raw strings
(r"C:\temp\my test").
Sincerely,
Albert
More information about the Python-list
mailing list