why my ouput is showing error? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

why my ouput is showing error?

try: f=open("filename.txt") print(f.read()) print(1/0) finally: f.close()

20th Jun 2019, 3:59 PM
Akil 🇧🇩
Akil 🇧🇩 - avatar
3 Answers
+ 1
except ZeroDivisionError:
20th Jun 2019, 4:19 PM
Choe
Choe - avatar
+ 1
Tnx,elder.
20th Jun 2019, 4:22 PM
Akil 🇧🇩
Akil 🇧🇩 - avatar
+ 1
Because atleast the ZeroDivisionError was not catched. There is also a risk for FileNotFoundError, which was not catched.
20th Jun 2019, 6:50 PM
Seb TheS
Seb TheS - avatar