os.path module

import os

pathname = 'dir/test.txt'
result = os.path.exists(pathname)

print(result)

Leave a Comment

Your email address will not be published. Required fields are marked *