check a directory

Robert Bossy Robert.Bossy at jouy.inra.fr
Mon Feb 25 05:41:59 EST 2008


Raj kumar wrote:
> Hi all,
> I'm using following code...
>
> for x in listdir(path)
>     some code.....
>
> but how i can check whether x is a directory or not?
> Because listdir() is giving all the files present in that path....
Take a look at the module os.path, especially the functions named isdir 
and walk.

RB



More information about the Python-list mailing list