Find and append file path

Peter Otten __peter__ at web.de
Thu Jan 12 12:32:02 EST 2017


Tim Chase wrote:
> def dir_iter(root):
> for fullpath in (
> os.path.join(path, dir_)
> for path, dirs, files in os.walk(root)
> for dir_ in dirs
> ):
> if os.path.isdir(fullpath):
> yield fullpath

Why did you add an explicit isdir() check? My understanding is that the 
names in dirs are known to be directories.


More information about the Python-list mailing list

AltStyle によって変換されたページ (->オリジナル) /