Another possible option is to check whether the filename is in the directory using os.listdir()
import osif 'foo.txt' in os.listdir(): # Do things
this will return true if it is and false if not
Another possible option is to check whether the filename is in the directory using os.listdir()
import osif 'foo.txt' in os.listdir(): # Do things
this will return true if it is and false if not