[Tutor] Python open of c:\ path Problem
tmz at pobox.com
Sat Aug 23 19:47:05 CEST 2008
Kent Johnson wrote:
> The \ character is a special 'escape' character that is used to insert
> non-printing characters into a string. \t represents a single tab
> character, not the two characters \ and t.
> To put an actual backslash into a string, you can either double it:
> or prefix the string with r to make a 'raw' string, which doesn't have
> any special meaning for \:
While I don't use Windows myself, I'm believe that you can also use
forward-slashes as the path separator, e.g.:
junkfile = open('c:/tmp/junkpythonfile','w')
(Pardon me if I'm completely wrong.)
Todd OpenPGP -> KeyID: 0xBEAF0CE3 | URL: www.pobox.com/~tmz/pgp
To grasp the true meaning of socialism, imagine a world where
everything is designed by the post office, even the sleaze.
-- P.J. O'Rourke
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 542 bytes
Desc: not available
More information about the Tutor