Directory

Irmen de Jong irmen.NOSPAM at xs4all.nl
Mon Jul 30 17:57:03 EDT 2007


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

Look up os.walk (allows you to selectively walk over files and directories)
and/or os.path.isdir (allows you to test if a given path is a directory)

--irmen



More information about the Python-list mailing list