How do I check if a file exists or not, without using the try statement?
Additionally, os.access():
os.access()
if os.access("myfile", os.R_OK): with open("myfile") as fp: return fp.read()
Being R_OK, W_OK, and X_OK the flags to test for permissions (doc).
R_OK
W_OK
X_OK