Study
Python · Exceptions
try/except/else/finally, catching specific exceptions, raising your own, and custom exception classes.
- Catch the narrowest exception you can handle; a bare except also swallows bugs.
- else runs only when the try block raised nothing, and finally always runs.