Python - Exception Handling Fundamentals
Which of the following functions correctly catches any exception and prints its message in Python?
except Exception as e:.e and prints it. def func():
try:
pass
except:
print('Error') uses bare except without variable. def func():
try:
pass
except Exception:
print('Error') catches exception but does not capture the message. def func():
try:
pass
except e:
print(e) uses invalid syntax except e:.15+ quiz questions · All difficulty levels · Free
Free Signup - Practice All Questions