I am trying to replace an Image file using Python PIL.
im = Image.open(logo_dir+cat_string_im)
What function do I call to delete the original file?
im.delete() or im.replace() don't work.
Probably the most straightforward way is to use os.remove()
to delete the file. This is basic functionality, so it's not too likely that every module that works with files also includes facilities for file copying, moving, deletion, etc.
You don't need PIL to delete the image. You can do it with
os.remove(path, *, dir_fd=None)
http://docs.python.org/3.3/library/os.html#os.remove
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With