I am trying to written this code which would just test whether a file exists and then reads it and prints. I have written this code as a file named readFile.py and trying to run it through shell using execfile command. I have put many print stmts to check till where the control is going. The result shows me only first two print stmts and the control is not entering the def readFile()..I am unable to find the reason and need help.Thanks!!
print 'i am doing fine'
filename = "train-win.dat"
print 'i am doing fine1'
def readFile():
print 'i am doing fine2'
import os
print 'i am doing fine3'
if os.path.exists(filename):
print 'i am doing fine4'
f = open(filename,"r")
print 'i am doing fine5'
a = f.readlines()
print 'i am doing fine6'
print a
print 'i am doing fine7'
f.close()p