exclude binary files from os.walk
bokr at oz.net
Fri Feb 25 16:07:27 EST 2005
On Wed, 26 Jan 2005 18:25:09 -0500, "Dan Perl" <danperl at rogers.com> wrote:
>"rbt" <rbt at athop1.ath.vt.edu> wrote in message
>news:ct94j7$15a$1 at solaris.cc.vt.edu...
>> Is there an easy way to exclude binary files (I'm working on Windows XP)
>> from the file list returned by os.walk()?
>> 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... and if so, what's the reasoning behind this? Again all of this
>> pertains to files on Windows XP and Python 2.4
>Please clarify: is your question about identifying binary (non-ascii) files
>or about using os.walk?
I have a feeling it's about walking directories and identifying which files
to should be "cooked" (to normalize line endings when opened and read).
More information about the Python-list