Sometime we have to delete a file or folder/directory in python. Either its empty or contain anything, please find the following steps,
To remove a file:
os.remove()
To remove an empty directory/folder:
os.rmdir()
To remove a directory and all its contents:
shutil.rmtree()
The following two tabs change content below.
Latest posts by karsho (see all)
- Increase maximum query size max_allowed_packet for MySQL - March 29, 2020