Skip to content

Instantly share code, notes, and snippets.

@mutaku
Created February 28, 2012 02:26
Show Gist options
  • Save mutaku/1928755 to your computer and use it in GitHub Desktop.
Save mutaku/1928755 to your computer and use it in GitHub Desktop.
python directory walking
import os
d = os.walk(some_dir)
m = {}
for root,dir,files in d:
m[root] = files
for key in m.keys():
print "Key => ",key," is ",len(key.split('/'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment