0

Why the print(2) statement is not printed after raise exception ? Can anyone help me......

21st Aug 2019, 2:47 PM
Rupal Raut
3 Réponses
0
Print(1) raise ValueError Print(2) In this code why print(2) is not executed ??
21st Aug 2019, 2:59 PM
Rupal Raut
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
21st Aug 2019, 3:26 PM
Bilbo Baggins
Bilbo Baggins - avatar