Categories
Python Answers

How to properly ignore exceptions in Python?

Spread the love

Sometimes, we want to properly ignore exceptions in Python.

In this article, we’ll look at how to properly ignore exceptions in Python.

How to properly ignore exceptions in Python?

To properly ignore exceptions in Python, we can use the pass keyword in the except clause.

For instance, we write:

try:
    raise Exception()
except:
    pass

to create an empty except clause with pass.

Conclusion

To properly ignore exceptions in Python, we can use the pass keyword in the except clause.

Leave a Reply

Your email address will not be published. Required fields are marked *