Re: Python open of c:\ path Problem

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Fredrik Lundh

    Re: Python open of c:\ path Problem

    Wayne Watson wrote:
    Python doesn't like this:
    >
    junkfile = open('c:\tmp\ju nkpythonfile',' w')
    >
    I get
    junkfile = open('c:\tmp\ju nkpythonfile',' w')
    IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpy thonfile'
    "\" is used as an escape character in string literals, so "\t" doesn't
    mean what you think it does. see



    for details.

    to work around this, use double backslashes ("foo\\bar") , raw strings
    (r"foo\bar"), or, usually easiest, forward slashes ("foo/bar").

    </F>

Working...