if condition to check if file does exist code example
Example 1: check if a file exists
>>> import os
>>> os.path.isfile("d:\\Package1\\package1\\fibo.py")
True
>>> os.path.isfile("d:/Package1/package1/fibo.py")
True
>>> os.path.isfile("d:\\nonexisting.txt")
Example 2: if file exist
file_exists ( string $filename ) : bool