Remove directories from os.listdir output

Remco Gerlich scarblac at pino.selwerd.nl
Sun Feb 18 11:00:56 EST 2001


Fernando Rodríguez <spamers at must.die> wrote in comp.lang.python:
> 	I need to filter out all the diretories of the list returned by
> os.listdir(). How can I tell if an entry of that list is a dir or a regular
> file? O:-)

With os.path.isdir(file).

-- 
Remco Gerlich



More information about the Python-list mailing list