import os for name in os.listdir("."): if os.path.isdir(name): print(str(name))
# Basic syntax: import os os.path.dirname('/path/to/your/favorite/file.txt') --> '/path/to/your/favorite/'