+ 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