how to get all folder only in a given path in python?
To print only the folders
print os.walk(DIR_PATH).next()[1]
To print only the files
print os.walk(DIR_PATH).next()[2]
Another method:
dirs = [entry.path for entry in os.scandir('Tools') if entry.is_dir()]
import os.path
dirs = [d for d in os.listdir('Tools') if os.path.isdir(os.path.join('Tools', d))]