How can I traverse a file system with a generator?

Why reinvent the wheel when you can use os.walk

import os
for root, dirs, files in os.walk(path):
    for name in files:
        print os.path.join(root, name)

os.walk is a generator that yields the file names in a directory tree by walking the tree either top-down or bottom-up

Leave a Comment

techhipbettruvabetnorabahisbahis forumueduseduseduseduseduseduedueduedusedus