'os.remove()' method remove a file.
remove_a_file_1.py
import os
path = '/Users/Shared/data/myfile.txt'
os.remove(path)
‘os.remove’ method throws ‘IsADirectoryError’ if the path points to a directory
‘os.remove’ method throws ‘FileNotFoundError’, if the file is not exists.
No comments:
Post a Comment