Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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 (106k 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

If you are interested to learn Python from Industry experts, you can sign up for this Python Certification Course by Intellipaat. 

Related questions

Browse Categories

...