ShriRam Changed status to publish August 21, 2023
try:
fh = open(“testfile.txt”, “w”)
try:
fh.write(“This is my test file for exception handling!!”)
finally:
print (“Going to close the file”)
fh.close()
except IOError:
print (“Error: can\’t find file or read data”)
ShriRam Changed status to publish August 21, 2023