> Message: 7
> Date: Sun, 24 Aug 2008 00:21:45 +0100
> From: "Alan Gauld" <[EMAIL PROTECTED]>
> Subject: Re: [Tutor] Python open of c:\ path Problem
> To: tutor@python.org
> Message-ID: <[EMAIL PROTECTED]>
> Content-Type: text/plain; format=flowed;
Alan Gauld wrote:
> "Wayne Watson" <[EMAIL PROTECTED]> wrote
>
>> BTW, how does one continue a long statement
>> that has, say, a long path to a file?
>
> You can create a long string by adding the shorter string
> elements :
>
> f = open(
> "a:/very/long/path/name/that/needs/a/whole/line/to./it
"Wayne Watson" <[EMAIL PROTECTED]> wrote
junkfile = open('c:\tmp\junkpythonfile','w')
IOError: [Errno 2] No such file or directory:
'c:\tmp\\junkpythonfile'
I suspect the problem is with the back slash. Comments?
Correct. There are several ways round this, the simplest
being to use forw
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:
> 'c:\\tmp\\junkpyth
On Sat, Aug 23, 2008 at 9:56 AM, Wayne Watson
<[EMAIL PROTECTED]> wrote:
> Python doesn't like this:
>
> junkfile = open('c:\tmp\junkpythonfile','w')
>
> I get
> junkfile = open('c:\tmp\junkpythonfile','w')
> IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile'
The \ characte
Title: Signature.html
Python doesn't like this:
junkfile = open('c:\tmp\junkpythonfile','w')
I get
junkfile = open('c:\tmp\junkpythonfile','w')
IOError: [Errno 2] No such file or directory: 'c:\tmp\\junkpythonfile'
This problematic segment is just a hack of a similar statement which