Determine file type (binary or text)

John Machin sjmachin at lexicon.net
Wed Aug 13 18:32:35 EDT 2003


"Michael Peuser" <mpeuser at web.de> wrote in message news:<bhdaks$f92$07$1 at news.t-online.com>...
> 
> When I had a similar problem I read 1000 characters, counted the amount of
> <32 and >255 characters and classified it "binary when this qota exceeded

How many characters > 255 did you get? Did you mean 127? If so, what
about accented characters ... like umlauts?

On a slightly more serious note, CR, LF, HT and FF would have to be
considered "text" but their ordinal values are < 32.

What was the problem that you thought you were solving?




More information about the Python-list mailing list