Wednesday, July 16, 2014

How to delete a file

Code
import os                                              #1
os.remove(file_path_string)                            #2

How this works - Line by Line

import os                                           #1

Imports the os module

os.remove(file_path_string)                         #2
 
This line deletes the file located in the file_path_string.  (An example file_path_string would be 'c:\temp\test.xls')

No comments:

Post a Comment