How to check whether a file exists or not without exceptions in python ?

It is easy to check whether a file exists or not without exceptions in python ,python has a familiar os.path module using this module you can run isfile ,if it return True means a file exists or if it is False means file not exists

Code to check whether a file exists or not without exceptions in python


import os.path
os.path.isfile(FILE_PATH)


e.g 

>>> os.path.isfile("/home/index.html")
True
>>> os.path.isfile("/home/index_new.html")
False

In python how to Find the index of an item in a list

Here we are going to elaborate In python how to Find the index of an item in a list,Suppose i have a list [“Red”, “blue”, “green”, “orange”] , How to find out  in the color list what is the position or key of “green”


 
           array1 = ["Red", "blue", "green", "orange"]

           print array1.index("green")      
           
           Output 
              
               2