Skip to main content

Hello all,

I have a Folder with subfolders:

How can i get the names subfolder with python?

Thanks in Advance,

An example.

>>> import os
>>> root = 'C:/Data'
>>> for file in os.listdir(root):
...     if os.path.isdir('%s/%s' % (root, file)):
...         print file

"os.walk" can also be used. See also the Python documentation.

BTW, why not use the PATH reader? 


Hello @takashi thanks your help. It was very important. :)

The reason that i don`t use the Path Reader on this case, is because i use in my workspace the Shutdown Python.

Thanks agian,

Danilo


Reply