New course! Every coder should learn Generative AI!
Try a free lesson0
try to open &read msg from file ,print the error msg in casse of exception
1 Answer
+ 1
try:
f=open("filename.txt")
a=f.read ()
print a
except:
print "Error"
finally:
f.close ()