"""author: pythonpips"""

import os

file_path = './example.txt'
exists = os.path.isfile(file_path)
print(exists)
# outputs True

credits: Herman van Belaster

How to Check If File Exists in Python

Subscribe to our newsletter