
6 Jan
2019
6 Jan
'19
12:38 a.m.
I was writing some python code earlier, and I noticed that in a code that looks somwhat like this one :
try: i = int("string") print("continued on") j = int(9.0) except ValueError as e: print(e)
"invalid literal for int() with base 10: 'string'"
this code will handle the exception, but the code in the try block will not continue.
I propose to be able to use the continue keyword to continue the execution of the try block even when an error is handled. The above could then be changed to :
try: i = int("string") print("continued on") j = int(9.0) except ValueError as e: print(e) continue
"invalid literal for int() with base 10: 'string'" "continued on"