Need help dealing with spaces in NT paths.
Fredrik Lundh
fredrik at pythonware.com
Wed Nov 17 05:43:51 EST 1999
T. C. Mits <71351.356 at compuserve.com> wrote:
> A simple example of the difficulty is:
>
> >>> os.system(r'"dir Program Files"')
> Bad command or file name
> 0
> >>>
strangely enough,
"os.system(r'dir Program Files')"
doesn't work either. nor does
c:\> "dir program files"
at the command prompt.
(when you get this far, you should have
realised how to fix this... but alright, I'll
spell it out:
c:\> dir "program files"
os.system('dir "program files"')
but in this specific case, you should use
"os.listdir" or perhaps "glob.glob" instead,
but that's another story...)
</F>
<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
(news: just posted an errata for the 'first printing') -->
More information about the Python-list
mailing list