Juliano Freitas wrote:
[color=blue]
> how can i get just the directories in other directorie without a files
> using the os module in Python??[/color]
You can test using os.path.isdir, for example:
[color=blue][color=green][color=darkred]
>>> import os
>>> [x for x in os.listdir('.') if os.path.isdir(x )][/color][/color][/color]
Check the os.walk() and os.path.walk() functions. More details and
some examples are at
<http://docs.python.org/lib/os-file-dir.html>
resp.
<http://docs.python.org/lib/module-os.path.html>
/Jean Brouwers
In article <mailman.6890.1 101764022.5135. python-list@python.org >,
Juliano Freitas <jubafre@atlas. ucpel.tche.br> wrote:
[color=blue]
> how can i get just the directories in other directorie without a files
> using the os module in Python??
>
>
> Juliano
>
>
>[/color]
Juliano Freitas <jubafre@atlas. ucpel.tche.br> writes:
[color=blue]
> how can i get just the directories in other directorie without a
> files using the os module in Python??[/color]
If there's a command for listing only dirs, I've not stumbled on it.
Comment