How to detect if file is a directory

César Leonardo Blum Silveira cesarbs at gmail.com
Sat Apr 9 18:37:21 EDT 2005


Thanks :-)

On Apr 9, 2005 3:55 PM, Tim Jarman <tmj at spamlessjarmania.com> wrote:
> César Leonardo Blum Silveira wrote:
> 
> > Hello all, I'm new to this list.
> >
> > How can I detect if a file is a directory or not?
> >
> > Thanks
> >
> > César
> 
> The os module contains many helpful tools for working with files,
> directories, links and so forth. Check out the docs and marvel. The
> following snippet answers your specific question:
> 
> <code>
> import os.path
> 
> if os.path.isdir("/some/path/here"):
>     print "It's a directory!"
> </code>
> --
> Website: www DOT jarmania FULLSTOP com
> --
> http://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list