]> granicus.if.org Git - python/commitdiff
walk() docs: Emphasize that the recursive-delete example is dangerous.
authorTim Peters <tim.peters@gmail.com>
Mon, 28 Apr 2003 19:15:10 +0000 (19:15 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 28 Apr 2003 19:15:10 +0000 (19:15 +0000)
Doc/lib/libos.tex

index 6a1223fd3bf226d3545199320a51a98f6bb81110..c9cf137b8ac79f4a1e0c17c9c8c9c9d6b9781b7f 100644 (file)
@@ -1126,6 +1126,8 @@ directory is empty:
 import os
 from os.path import join
 # Delete everything reachable from the directory named in 'top'.
+# CAUTION:  This is dangerous!  For example, if top == '/', it
+# could delete all your disk files.
 for root, dirs, files in os.walk(top, topdown=False):
     for name in files:
         os.remove(join(root, name))