os.walk(): Changed the "sum of bytes consumed by files" example to use

a generator expression instead of a listcomp.

Not a backport candidate (genexps are new in 2.4).
This commit is contained in:
Tim Peters 2004-11-22 16:53:46 +00:00
parent 919a3b40f9
commit 7f13cfa674

View file

@ -1174,7 +1174,7 @@ import os
from os.path import join, getsize
for root, dirs, files in os.walk('python/Lib/email'):
print root, "consumes",
print sum([getsize(join(root, name)) for name in files]),
print sum(getsize(join(root, name)) for name in files),
print "bytes in", len(files), "non-directory files"
if 'CVS' in dirs:
dirs.remove('CVS') # don't visit CVS directories