I'd like to use Python 3.3.3 to test for the existence of a backup file.
Something like this:
if backup does not exist:
create it
write to backup
otherwise:
run other procedures not related to backup file
Any suggestions?
I'd like to use Python 3.3.3 to test for the existence of a backup file.
Something like this:
if backup does not exist:
create it
write to backup
otherwise:
run other procedures not related to backup file
Any suggestions?
Use os.path.exists
or os.path.isfile
:
>>> import os
>>> os.path.isfile('/path/to/file')
False