exclude binary files from os.walk
craig at postnewspapers.com.au
Thu Jan 27 01:47:49 EST 2005
On Wed, 2005-01-26 at 17:32 -0500, rbt wrote:
> Grant Edwards wrote:
> > On 2005-01-26, rbt <rbt at athop1.ath.vt.edu> wrote:
> >>Is there an easy way to exclude binary files (I'm working on
> >>Windows XP) from the file list returned by os.walk()?
> > Sure, assuming you can provide a rigorous definition of 'binary
> > files'. :)
That's not really safe when dealing with utf-8 files though, and IIRC
with UCS2 or UCS4 as well. The Unicode BOM its self might (I'm not sure)
qualify as ASCII.
More information about the Python-list