How do I check if a file exists or not, without using the try statement?
In 2016 the best way is still using os.path.isfile:
os.path.isfile
>>> os.path.isfile('/path/to/some/file.txt')
Or in Python 3 you can use pathlib:
pathlib
import pathlib path = pathlib.Path('/path/to/some/file.txt') if path.is_file(): ...