Exceptions Flashcards
1
Q
AssertionError
A
should never raise yourself
2
Q
Try Except
A
try:
pass
except Exception as e:
pass
else:
pass
finaly:
pass
3
Q
Raise
A
raise Exception(“message”)
4
Q
Assert
A
assert [condition], [error message]
error message optional
5
Q
Finally
A
executes after return
cleanup
6
Q
Custom Exception
A
class CustomException (Exception):
“"”Docstring”””
7
Q
Multiple Exceptions
A
except (Type1, Type2) as e:
8
Q
BaseException
A
base class of exceptions