Skip to content

Commit 00753f5

Browse files
committed
Update os.fwalk example
1 parent 51c58e3 commit 00753f5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

Doc/library/os.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3727,16 +3727,16 @@ features:
37273727

37283728
This example displays the number of bytes taken by non-directory files in each
37293729
directory under the starting directory, except that it doesn't look under any
3730-
CVS subdirectory::
3730+
``__pycache__`` subdirectory::
37313731

37323732
import os
3733-
for root, dirs, files, rootfd in os.fwalk('python/Lib/email'):
3733+
for root, dirs, files, rootfd in os.fwalk('python/Lib'):
37343734
print(root, "consumes", end="")
37353735
print(sum([os.stat(name, dir_fd=rootfd).st_size for name in files]),
37363736
end="")
37373737
print("bytes in", len(files), "non-directory files")
3738-
if 'CVS' in dirs:
3739-
dirs.remove('CVS') # don't visit CVS directories
3738+
if '__pycache__' in dirs:
3739+
dirs.remove('__pycache__') # don't visit __pycache__ directories
37403740

37413741
In the next example, walking the tree bottom-up is essential:
37423742
:func:`rmdir` doesn't allow deleting a directory before the directory is

0 commit comments

Comments
 (0)