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
In Python 3.4 or later version, the pythonic way would be:
import os from contextlib import suppress with suppress(OSError): os.remove(filename)