I want to delete the file filename if it exists. Is it proper to say
filename
if os.path.exists(filename): os.remove(filename)
Is
Another solution with your own message in exception.
import os try: os.remove(filename) except: print("Not able to delete the file %s" % filename)