César Leonardo Blum Silveira wrote:
[color=blue]
> Hello all, I'm new to this list.
>
> How can I detect if a file is a directory or not?
>
> Thanks
>
> César[/color]
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
On Apr 9, 2005 3:55 PM, Tim Jarman <tmj@spamlessja rmania.com> wrote:[color=blue]
> César Leonardo Blum Silveira wrote:
> [color=green]
> > Hello all, I'm new to this list.
> >
> > How can I detect if a file is a directory or not?
> >
> > Thanks
> >
> > César[/color]
>
> 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
>[/color]
Comment