os.listdir: which ones are directories?
Stephen Boulet
stephen at theboulets.net
Tue Jan 15 00:54:01 EST 2002
That was a fast response. Thanks! I'm just fooling around with anygui and
wanted to make a file browser.
-- Stephen
Peter Hansen wrote:
> Stephen Boulet wrote:
>>
>> Does anyone know how to tell which of the strings from
>> os.lisdir('somedir') are directories? Thanks.
>
>>>> import os
>>>> for i in os.listdir('.'):
> ... if os.path.isdir(i):
> ... print 'Dir', i
> Dir a
> Dir RECYCLED
> Dir TEMP
> Dir dev
> Dir bin
> Dir backup
> Dir WINDOWS
> Dir Program Files
> Dir My Documents
> Dir cache
>
> -Peter
More information about the Python-list
mailing list