os.system and quoted strings
Sion Arrowsmith
siona at chiark.greenend.org.uk
Wed Feb 28 09:28:48 EST 2007
Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote:
>>>> import os.path
>>>> os.path.join("c:",
>... "Documents and Settings",
>... "somepath")
>'c:Documents and Settings\\somepath'
>>>>
>
>Hmmm, a quick test with
>
>dir "e:userdata"
>
>worked, so the top level \ may not be needed...
"drive:" is the 'cwd' on the drive, so "drive:directory" is relative
to that. Try "cd e:userdata" and repeat "dir e:userdata" and see what
happens. os.path.join() has to behave as above, otherwise you wouldn't
be able to use it to construct a relative path like that.
(And since I don't think anyone's mentioned it in this thread yet,
subprocess.call() instead of os.system().)
--
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
___ | "Frankly I have no feelings towards penguins one way or the other"
\X/ | -- Arthur C. Clarke
her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
More information about the Python-list
mailing list