Dealing with trying to read a file that might not exist
import os
if os.path.isfile('./file.txt'):
# do something with the file
A try
/ except
is indeed the best way.
import os
if os.path.isfile('./file.txt'):
# do something with the file
A try
/ except
is indeed the best way.