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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kent Johnson Sent: Thursday, 11 May 2006 1:03 AM Cc: tutor@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@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:[EMAIL PROTECTED] 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 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor