0
Why the print(2) statement is not printed after raise exception ? Can anyone help me......
2 Respostas
0
Print(1)
raise ValueError
Print(2)
In this code why print(2) is not executed ??
0
In Python, unhandled exceptions abort the program and all following code is skipped.
You must:
(1) include the code in a guarded snippet:
try: raise ValueError
(2) handle raised exceptions:
except: pass
or
except: print("raised")
This way print(2) will be reached