Hi, Explain how to delete a file in Python
1 Like
If you want to delete a file in Python, you will have to import OS module first, and then call os.remove()
function.
For example, if you want to delete a file File1.txt
, the following piece of code will help:
import os
os.remove("File1.txt")
Hope it is helpful!
1 Like