I am trying to get the code to list all the directories in a folder, change directory into that folder and get the name of the current folder. The code I have so far is belo
import os for root, dirs, files in os.walk(top, topdown=False): for name in dirs: print os.path.join(root, name)
Walk is a good built-in for what you are doing