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.
>

import os
listofdirs=[d for d in os.listdir(mydir) if os.pathisdir(d)]

-Larry

previous
next

Re: Co-developers wanted: document markup language
Creation and destruction responsibilities
Unequal Length Maze
Re: Program with wx in Linux and Windows
Re: Interface Programming the basics
Fundacja Iskierka
Mimo Wszystko
Fundacja Avalon
Podaruj Zycie
Nasze Dzieci