exclude binary files from os.walk

rbt rbt at athop1.ath.vt.edu
Wed Jan 26 17:11:51 EST 2005


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

Many thanks!



More information about the Python-list mailing list