Sunday, December 12, 2010

python - delete file

import os
afile = '/filepath/filename'
# get absolute path (does not inlcude symlinks, use realpath instead to eliminate symlinks) of the file
afile = os.path.abspath(afile)
os.remove(afile)



No comments:

Post a Comment