module on files & directories

Robert Brewer fumanchu at
Thu Jan 13 17:50:19 CET 2005

Sara Fwd wrote:
> > Can anybody help me find a module or a function that
> > looks in a directory and defines whether the objects
> > in there are files or directories?

and Simon Brunning replied:
> See os.path.isfile() and os.path.isdir() -
> <>.

I suspect you will also want to look at os.walk() eventually:

    for root, dirs, files in os.walk(path):
        for dir in dirs:

Robert Brewer
Amor Ministries
fumanchu at

More information about the Python-list mailing list