0 votes
1 view
in Python by (7.3k points)

I have a try...except block in my code and When an exception is throw. I really just want to continue with the code because in that case, everything is still able to run just fine. The problem is if you leave the except: block empty or with a #do nothing, it gives you a syntax error. I can't use continue because it's not in a loop. Is there a keyword I can use that tells the code to just keep going?

1 Answer

0 votes
by (107k points)

If you want to ignore an exception and want to proceed further then you can use the following piece of code:-

try:

do_something()

except Exception:

pass

Related questions

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...