Video 5: Conditionals (page 9 of 10) |
We can have a bare except block to capture all errors in the try block or a specific except condition that only gets fired for a specific type of error.
In the code snippet on the left, the except block will execute for any error in the try block. In the code snippet on the right, the except block will only execute for a KeyError in a statement in the try block.