exclude binary files from os.walk

Grant Edwards grante at visi.com
Wed Jan 26 18:26:55 EST 2005


On 2005-01-26, Larry Bates <lbates at syscononline.com> wrote:

> There's no definitive way of telling a file is "non-ascii".
> Bytes in a binary file define perfectly good ascii characters.

As long as bit 7 is a 0.  

Traditional ASCII only allows/defines the values 0x00 through
0x7f.  If that's what is meant by "ASCII", then a file
containting bytes greater than 0x7F is not ASCII. 

If all bytes are 0x7F or below, the file _may_ be ASCII, but
there's now way to tell if it _is_ ASCII unless you ask the
creator of the file.  It could be Baudot or some other encoding
that doesn't use bit 7.  Or, it could just be binary data that
happens to have bit 7 == 0.

> We could be of more help, if you would take the time to
> explain a little about what you are trying to do.

Yup.

-- 
Grant Edwards                   grante             Yow!  Now, let's SEND OUT
                                  at               for QUICHE!!
                               visi.com            



More information about the Python-list mailing list