mirror of
https://github.com/python/cpython.git
synced 2025-07-31 23:23:11 +00:00
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:
parent
919a3b40f9
commit
7f13cfa674
1 changed files with 1 additions and 1 deletions
|
@ -1174,7 +1174,7 @@ import os
|
||||||
from os.path import join, getsize
|
from os.path import join, getsize
|
||||||
for root, dirs, files in os.walk('python/Lib/email'):
|
for root, dirs, files in os.walk('python/Lib/email'):
|
||||||
print root, "consumes",
|
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"
|
print "bytes in", len(files), "non-directory files"
|
||||||
if 'CVS' in dirs:
|
if 'CVS' in dirs:
|
||||||
dirs.remove('CVS') # don't visit CVS directories
|
dirs.remove('CVS') # don't visit CVS directories
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue