0 votes
1 view
in Python by (53.7k points)

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

1 Answer

0 votes
by (116k 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
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...