python loop through subdirectories

Probably one of the weirdest python code i have ever seen to loop through files in a directory. But i think its pretty efficient.

for subdir, dirs, files in os.walk("."):
    for file in files:
        print os.path.join(subdir, file)

-Yay! prints all the files in a directory.


Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

OpenCover code coverage for .Net Core

A quick tutorial for OWASP ZAP tool for beginners