Determine file type (binary or text)

Grant Edwards grante at
Wed Aug 13 20:10:22 CEST 2003

In article <AFm_a.9725$g4.189983 at>, Sami Viitanen wrote:

> How can I check if a file is binary or text?

In order to provide an answer, you'll have to define "binary"
and "text".

> There was some easy way but I forgot it..

To _me_ a file isn't "binary" or "text".  Those are two modes
you can use to read a file.  The file itself is neutral on the
matter. At least under Windows and Unix.  VMS and FILES-11
contained a _lot_ more meta-data and actually did have several
different fundamental file types (fixed length records,
variable length records, byte-stream, etc.).

Grant Edwards                   grante             Yow!  Will it improve my
                                  at               CASH FLOW?

More information about the Python-list mailing list