exclude binary files from os.walk
Grant Edwards
grante at visi.com
Wed Jan 26 17:15:23 EST 2005
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'. :)
> Also, when reading files and you're unsure as to whether or
> not they are ascii or binary, I've always thought it safer to
> 'rb' on the read, is this correct...
That depends on what you want. Adding a 'b' will disable the
cr/lf handling. Not sure what else it does.
> and if so, what's the reasoning behind this?
Behind what?
> Again all of this pertains to files on Windows XP and Python 2.4
--
Grant Edwards grante Yow! Now that I have my
at "APPLE", I comprehend COST
visi.com ACCOUNTING!!
More information about the Python-list
mailing list