os.walk() returns three values on each iteration of the loop:
-
The name of the current folder
-
A list of folders in the current folder
-
A list of files in the current folder
- os.rmdir() delete the directory which is empty,otherwise you can’t delete it directly.
- If you want to delete all of the directory ,then you can use os.rmtree().