Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (55.6k points)

Can anyone tell me how do you ignore an exception in Python?

1 Answer

0 votes
by (119k points)

You can use pass in the except clause to ignore an exception as shown in following example:

try:

    print(invalid-variable)

except Exception:

    pass

print("Exception ignored")

OUTPUT:

Exception ignored

I recommend enrolling in this Python Certification Course by Intelllipaat to learn Python.

You can watch this Exception Handling in Python:

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
0 votes
2 answers
asked Oct 15, 2019 in Python by Sammy (47.6k points)

Browse Categories

...