Python Tutorial

Friday, August 20, 2010

python exception handling

'''
   This code use exception handling syntax
'''

directory ="C:/pythonInputFile.txt"
try:
    f=open(directory,'r')
    print f.read()
    f.close()
except:
    print "File not found/problem on reading file"
finally:
    print "It always works"

0 comments:

Post a Comment