Determine file type (binary or text)

Peter Hansen peter at engcorp.com
Wed Aug 13 22:10:32 EDT 2003


John Machin wrote:
> 
> Trent Mick <trentm at ActiveState.com> wrote in message news:<mailman.1060797503.18604.python-list at python.org>...
> 
> > 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