Are there any way to check the file existence in Python script.
There is a ".exists" function that will return True. Off the top of my head...
import os
print(os.file.exists("myfile.txt"))
Will print True if file exists, and False if it is missing.
Code may not be 100% but should be close
-Otanx
Python provides exists() function which can be used like below. Look https://www.networking-forums.com/programming-goodies-and-software-defined-networking/check-file-existing-with-python-script for more information.
import os.path
if(os.path.exists("/etc/passwd")):
print("/etc/passwd exists")