binary file woes... (was: Re: chr(26) => file reading bug)

Jeff Senn senn at maya.com
Tue Mar 28 23:04:08 CEST 2000


"Fredrik Lundh" <effbot at telia.com> writes:
> Michal Bozon <bozon at natur.cuni.cz> wrote:
> > When it is opened a file containing a char chr(26) (i.e. chr(0x1A)), it is
> > read only until this char.
...
> by reading the fine manual:
> http://www.python.org/doc/current/lib/built-in-funcs.html
...
>     If mode is omitted, it defaults to 'r'. When opening a binary file, you
>     should append 'b' to the mode value for improved portability. (It's
>     useful even on systems which don't treat binary and text files
>     differently, where it serves as documentation.)

Reminds me -- I noticed the other day that 'cmp.py' opens files in
default/non-binary mode which nearly caused me to delete a whole bunch
of non-different files... :-( given the name of the module and the
analogous unix command -- this is probably the wrong behavior...

-- 
-Jas





More information about the Python-list mailing list