Python provides exists() function which can be used like below.

import os.path

if(os.path.exists("/etc/passwd")):

print("/etc/passwd exists")