In the following programs you will learn that how to check if file exist or not. Using getmtime() and getctime() functions of 'os.path' library we can view created and last modified date and time of file.
import os.path, time
file = "C://MyTxtFile.txt"
print("last modified: %s" % time.ctime(os.path.getmtime(file)))
print("created: %s" % time.ctime(os.path.getctime(file)))
import os.path
print(os.path.exists("C://MyTxtFile.txt")) #True
import sys #U also Import Libraries like 'import sys,keyword'.
import keyword
print("Python version: ", sys.version_info)
print("Python keywords: ", keyword.kwlist)
import os
print(os.getcwd())