summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libos.tex10
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/lib/libos.tex b/Doc/lib/libos.tex
index 704b057..91923c4 100644
--- a/Doc/lib/libos.tex
+++ b/Doc/lib/libos.tex
@@ -1185,16 +1185,16 @@ In the next example, walking the tree bottom up is essential:
directory is empty:
\begin{verbatim}
-import os
-from os.path import join
-# Delete everything reachable from the directory named in 'top'.
+# Delete everything reachable from the directory named in 'top',
+# assuming there are no symbolic links.
# CAUTION: This is dangerous! For example, if top == '/', it
# could delete all your disk files.
+import os
for root, dirs, files in os.walk(top, topdown=False):
for name in files:
- os.remove(join(root, name))
+ os.remove(os.path.join(root, name))
for name in dirs:
- os.rmdir(join(root, name))
+ os.rmdir(os.path.join(root, name))
\end{verbatim}
\versionadded{2.3}