Skip to content

Commit b55d8e8

Browse files
committed
Update os.walk example
1 parent 5eb7fd4 commit b55d8e8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Doc/library/os.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3665,16 +3665,16 @@ features:
36653665

36663666
This example displays the number of bytes taken by non-directory files in each
36673667
directory under the starting directory, except that it doesn't look under any
3668-
CVS subdirectory::
3668+
\_\_pycache\_\_ subdirectory::
36693669

36703670
import os
36713671
from os.path import join, getsize
36723672
for root, dirs, files in os.walk('python/Lib/email'):
36733673
print(root, "consumes", end=" ")
36743674
print(sum(getsize(join(root, name)) for name in files), end=" ")
36753675
print("bytes in", len(files), "non-directory files")
3676-
if 'CVS' in dirs:
3677-
dirs.remove('CVS') # don't visit CVS directories
3676+
if '__pycache__' in dirs:
3677+
dirs.remove('__pycache__') # don't visit __pycache__ directories
36783678

36793679
In the next example (simple implementation of :func:`shutil.rmtree`),
36803680
walking the tree bottom-up is essential, :func:`rmdir` doesn't allow

0 commit comments

Comments
 (0)