[Tutor] For loop question

STREET Gideon (SPARQ) Gideon.STREET at ergon.com.au
Thu May 11 03:55:15 CEST 2006


Thanks all, appears it is the newline character which was causing me
grief.  For some reason I still have to do a readlines on the open file
at this stage, but I can muck about with that to figure it out.

Cheers

-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org] On
Behalf Of Kent Johnson
Sent: Thursday, 11 May 2006 1:03 AM
Cc: tutor at python.org
Subject: Re: [Tutor] For loop question

w chun wrote:
> Kent Johnson wrote:
>> For short Python scripts I usually allow the runtime to close the
file.
>> For longer programs and anything written in Jython (which has
>> different garbage collection behaviour) I usually use an explicit
close().
>
> i'm still not comfortable without doing my own explicit close(), esp.
> for writing to files... maybe i'm just used to malloc/new-free pairs
> like i am with open-close, although on the other hand, getting rid of
> another line of code is tempting -- so i will actually do this with a
> short piece of code that is read-only.

Yes, for writing files I always use an explicit close(), thanks for the
correction!

Kent

_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor



This e-mail (including any attachments) may contain confidential or
privileged information and is intended for the sole use of the person(s) to
whom it is addressed. If you are not the intended recipient, or the person
responsible for delivering this message to the intended recipient, please
notify the sender of the message or send an e-mail to
mailto:help.desk at ergon.com.au immediately, and delete all copies. Any
unauthorised review, use, alteration, disclosure or distribution of this
e-mail by an unintended recipient is prohibited. Ergon Energy accepts no
responsibility for the content of any e-mail sent by an employee which is of
a personal nature.

Ergon Energy Corporation Limited      ABN 50 087 646 062
Ergon Energy Pty Ltd      ABN 66 078 875 902


More information about the Tutor mailing list