How to detect if file is a directory
Tim Jarman
tmj at SPAMLESSjarmania.com
Sat Apr 9 14:55:06 EDT 2005
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
More information about the Python-list
mailing list