import os# for testing purpose args defaulted to current folder & file. # returns True if file founddef file_exists(FOLDER_PATH='../', FILE_NAME=__file__): return os.path.isdir(FOLDER_PATH) \ and os.path.isfile(os.path.join(FOLDER_PATH, FILE_NAME))
Basically a folder check, then a file check with proper directory separator using os.path.join.