👉Every exception in Python is an object.
👉For every exception type, the
corresponding classes are available.
👉Whenever an exception occurs, PVM will create the corresponding exception object and will check for handling code.
👉If handling code is not available, then the Python interpreter terminates the program abnormally and prints corresponding exception information to the console.
👉The rest of the program won’t be executed.
Ex:Python1.py
1) print("Hello")
2) print(10/0)
3) print("Hi")
Output:
D:\Python3>py Python1.py
Hello
Traceback (most recent call last):
File "test.py", line 2, in <module>
print(10/0)
ZeroDivisionError: division by zero

No comments:
Post a Comment
Thank you Very Much.For Given Comment