Need to modify files top to bottom using python's os walk. Generator object?
Question: I need to modify some files using a python script, and I figure OS walk is the
way to go about it. I need to modify everything under

    
    
    /foo/bar
    /foo/baz
    /foo/bat
    ....for example
    

I've never used os.walk before, I read a bit about it and I see that it
traverses down the file structure top to bottom. However, when I did a bit of
debugging, the object os.walk returns is something called a generator, and I'm
not sure how to go about modifying the files with this object. Does anyone
know how to modify files in a top to bottom order using pythons os.walk?
Examples, links to examples?


Answer: 
    import os
    for root, dirs, files in os.walk('.'):
        print root, dirs,files
    

