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
os.path.exists returns True for folders as well as files. Consider using os.path.isfile to check for whether the file exists instead.
True