Exception Handling

In [12]:
try:
    fh = open("testfile", "r")
    fh.write("This is my test file for exception handling!!")
    try:
        print("in second try")
    finally:
        print("in second try finally")
except Exception as e:
    print ("Error: can\'t find file or read data")
    print(e)
Error: can't find file or read data
not writable
www.000webhost.com