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
Take a look at os.path.exists.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With