Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
in Python by (55.5k 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

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

28.4k questions

29.7k answers

500 comments

94.6k users

Browse Categories

...