Determine file type (binary or text)

Peter Hansen peter at
Thu Aug 14 04:10:32 CEST 2003

John Machin wrote:
> Trent Mick <trentm at> wrote in message news:<mailman.1060797503.18604.python-list at>...
> > Generally I define a text file as "it has no null bytes". I think this
> > is a pretty safe definition (I would be interested to hear practical
> > experience to the contrary).
> Data file written by C program which has an off-by-one error and is
> including a trailing '\0' byte ...

To be fair, I'd call that a "binary" file in any case, or at least
a defective text file...

More information about the Python-list mailing list