+ 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 Antworten
+ 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