[Tutor] file.read() doesn't give full contents of compressed files
Barton David
David.Barton at nottingham.ac.uk
Tue Feb 20 14:45:05 CET 2007
I see. Thanks for that.
dave
-----Original Message-----
From: Kent Johnson [mailto:kent37 at tds.net]
Sent: 20 February 2007 13:30
To: Barton David
Cc: tutor at python.org
Subject: Re: [Tutor] file.read() doesn't give full contents of
compressed files
Barton David wrote:
> Oh... of course. Thanks and sorry for missing the bleeding obvious.
>
> Mind you, when reading in 'txt mode' rather than binary, len()
> actually gives a much *smaller* size than getsize. Does the conversion
> into txt happen to introduce some sort of terminator character that
> stops
> file.read() from going to the end?
Actually, yes. A ctrl-Z is treated as an end-of-file when reading a file
in text mode on Windows.
http://groups.google.com/group/comp.lang.python/msg/4604aac0222a0043?hl=
en&
Kent
This message has been checked for viruses but the contents of an attachment
may still contain software viruses, which could damage your computer system:
you are advised to perform your own checks. Email communications with the
University of Nottingham may be monitored as permitted by UK legislation.
More information about the Tutor
mailing list