Created
September 19, 2016 03:58
-
-
Save MOOOWOOO/8ff737a579dad349f45b0a73f2a0bf35 to your computer and use it in GitHub Desktop.
print tree of dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| def Test3(rootDir, level=1): | |
| if level==1: | |
| print(rootDir) | |
| for lists in os.listdir(rootDir): | |
| path = os.path.join(rootDir, lists) | |
| print('│ ' * (level - 1) + '│--' + lists) | |
| if os.path.isdir(path): | |
| Test3(path, level+1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment