a=0
try:
print("In Try Block !")
a = 10/0
except Exception as e:
print("In Exception Block !")
raise e
finally:
print("In Finally Block !")
print(a)
pass
When I run the above code I get output as below. I don't get the flow of this script.
In Try Block !
Traceback (most recent call last):
In Exception Block !
In Finally Block !
0
File "C:\Users\reccer\Documents\Practicals\test.py", line 7, in <module>
raise e
File "C:\Users\reccer\Documents\Practicals\test.py", line 4, in <module>
a = 10/0
ZeroDivisionError: division by zero
[Finished in 0.3s with exit code 1]
- Enters try block.
- founds error
- Enters except block.
- prints "In Exception Block !"
- Enters finally block.
- prints "In Finally Block !" & prints a.
- then performs formalities of raise e from except block.
I can't get any concrete reference for flow of control.