Gettings subdirectories
johnzenger at gmail.com
johnzenger at gmail.com
Wed May 3 15:15:20 EDT 2006
It's a bit overkill, but consider using os.walk.
root, dirnames, filenames = os.walk(r"C:\").next() # (in real code,
you'd want to catch exceptions here)
print dirnames
Florian Lindner wrote:
> Hello,
> how can I get all subdirectories of a given directories? os.listdir() gives
> me all entries and I've found no way to tell if an object is a file or a
> directory.
>
> Thanks,
>
> Florian
More information about the Python-list
mailing list