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)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

30.5k questions

32.6k answers

500 comments

108k users

Browse Categories

...