+ 1
why my ouput is showing error?
try: f=open("filename.txt") print(f.read()) print(1/0) finally: f.close()
3 Answers
+ 1
except ZeroDivisionError:
+ 1
Tnx,elder.
+ 1
Because atleast the ZeroDivisionError was not catched.
There is also a risk for FileNotFoundError, which was not catched.