Skip to content

Commit 3206128

Browse files
committed
edit handling files tutorial
1 parent 78e4687 commit 3206128

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

python-standard-library/handling-files/listing_files.py python-standard-library/handling-files/handling-files.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import shutil
23

34
# print the current directory
45
print("The current directory:", os.getcwd())
@@ -46,8 +47,10 @@
4647
# remove the folder
4748
os.rmdir("folder")
4849

49-
# remove nested folders
50+
# remove nested empty folders
5051
os.removedirs("nested1/nested2/nested3")
52+
# remote non-empty folders
53+
shutil.rmtree("nested1")
5154

5255
open("text.txt", "w").write("This is a text file")
5356

0 commit comments

Comments
 (0)