How do I check whether a file exists without exceptions?
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
You must login to ask question.
To check if a file exists, you pass the file path to the
exists()
function from theos.path
standard library.First, import the
os
standard library:import os
os.path.exists(path)