How can I check if the listdir result a directory?

Tim Daneliuk tundra at
Fri Mar 23 06:53:22 CET 2007

Plissken.s at wrote:
> I have the following code which list out all the files/directories
> under the current directory.
> But how can I find out if 'f' is a directory?
> for f in os.listdir("."):
>      // how can I check if 'f' a directory?

Try os.path.isdir()

Tim Daneliuk     tundra at
PGP Key:

More information about the Python-list mailing list