Kaydet (Commit) 7f13cfa6 authored tarafından Tim Peters's avatar Tim Peters

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).
üst 919a3b40
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment