Home

Rohan wrote:
> I would like to get a list of sub directories in a directory.
> If I use os.listdir i get a list of directories and files in that .
> i only want the list of directories in a directory and not the files
> in it.
> anyone has an idea regarding this.

How far down do you want to go?

All the way to the bottom:

for root, dirs, files in os.walk('.'):
for d in dirs:
print os.path.join(root, d)

####################################

Only your current directory:

x = os.listdir('.')
for item in x:
if os.path.isdir(item):
print item

previous
next

Re: C++ Primer ex 7.6
Re: inline function
ctypes and unsigned char*
Re: lxml + mod_python: cannot unmarshal code objects in restrictedexecution mode
mod_python preprocess/filter before proxy
tanie pozycjonowanie
cloud
download
wnętrza poznań
pozycjonowanie rzeszów