[Tutor] skip some directories
Jonas Melian
jonasmg at softhome.net
Mon May 30 22:05:27 CEST 2005
Hi,
I'm trying to working with some directories only
import os
dirName = "/usr/share/fonts/"
dirBase = ['misc','TTF','Type1','CID','100dpi','75dpi'] # directories to
skip
for root, dirs, files in os.walk(dirName):
for end in dirBase:
if root.endswith(end):
print 'skiped'
else:
print root
# but this fails, because always run 'print root'
#This is the only way:
if root.endswith('misc'):
print 'skiped'
else:
...
#but how pass all values in 'dirBase'?
Thanks in advance!
More information about the Tutor
mailing list