Python - Exception Handling Fundamentals
Which of the following code snippets correctly catches all exceptions using a generic handler in Python?
Exception is except Exception:.except Exception: correctly. try:
pass
except:
print('Error') uses bare except: which catches all exceptions including system-exit, but is discouraged. try:
pass
except Error:
print('Error') uses an undefined Error class. try:
pass
catch Exception:
print('Error') uses invalid keyword catch.except Exception: to catch most errors [OK]15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions