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
Something like this? Takes advantage of short-circuit evaluation. If the file does not exist, the whole conditional cannot be true, so python will not bother evaluation the second part.
os.path.exists("gogogo.php") and os.remove("gogogo.php")