os.walk bug?
Terry Reedy
tjreedy at udel.edu
Thu Dec 16 15:23:36 EST 2004
os.walk bug?-------
for d in dirs:
# -- remove archive
if d[:2] == '20':
print "--- removing:", d
dirs.remove(d)
----------
Please post in plain text, not html/rtf. It is easier to reply to.
Without looking at your output, I suspect the above is one of your
problems. Do not add/or remove items from a list that you are iterating
over unless you are *very* sure it actually gives you what you really want
(and then a comment might be in order). This is a common new-to-Python
mistake. Try 'for d in list(dirs):' and see if your output improves.
Terry J. Reedy
More information about the Python-list
mailing list