Skip to content

Commit

Permalink
pythongh-57179: Add note on symlinks for os.walk (python#94799)
Browse files Browse the repository at this point in the history
  • Loading branch information
slateny authored and mpage committed Oct 11, 2022
1 parent 6444029 commit c42b931
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Doc/library/os.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3222,7 +3222,8 @@ features:
filenames)``.

*dirpath* is a string, the path to the directory. *dirnames* is a list of the
names of the subdirectories in *dirpath* (excluding ``'.'`` and ``'..'``).
names of the subdirectories in *dirpath* (including symlinks to directories,
and excluding ``'.'`` and ``'..'``).
*filenames* is a list of the names of the non-directory files in *dirpath*.
Note that the names in the lists contain no path components. To get a full path
(which begins with *top*) to a file or directory in *dirpath*, do
Expand Down
3 changes: 2 additions & 1 deletion Lib/os.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,8 @@ def walk(top, topdown=True, onerror=None, followlinks=False):
dirpath, dirnames, filenames
dirpath is a string, the path to the directory. dirnames is a list of
the names of the subdirectories in dirpath (excluding '.' and '..').
the names of the subdirectories in dirpath (including symlinks to directories,
and excluding '.' and '..').
filenames is a list of the names of the non-directory files in dirpath.
Note that the names in the lists are just names, with no path components.
To get a full path (which begins with top) to a file or directory in
Expand Down

0 comments on commit c42b931

Please sign in to comment.