[Tutor] manipulating a file

Mike Bell ternary at gmail.com
Mon Feb 7 22:37:47 CET 2005


without the explicit newlines in file.write(i), could it be that the
file was closed before the write buffer was ever flushed?

mike


On Mon, 7 Feb 2005 14:58:03 -0500, Smith, Jeff <jsmith at medplus.com> wrote:
> -----Original Message-----
> From: Alan Gauld [mailto:alan.gauld at freenet.co.uk]
> Sent: Monday, February 07, 2005 2:49 PM
> To: Reed L. O'Brien; tutor at python.org
> Subject: Re: [Tutor] manipulating a file
> 
> >You should add a newline character otherwise you will just
> >get one enormously long line!
> >
> >                dstfile.write(i+'\n')
> 
> In these cases, I've taken to doing
>         print >> dstfile, I
> 
> ...hmmm starting to look like Perl's many ways to accomplish the same
> thing approach :-)
> 
> Jeff
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list