1import os
2
3os.path.exists("file.txt") # Or folder, will return true or false
1import os
2
3PATH = './file.txt'
4if os.path.isfile(PATH) and os.access(PATH, os.R_OK):
5 print("File exists and is readable")
6else:
7 print("Either the file is missing or not readable")