Skip to main content

One doc tagged with "errors"

View all tags

Introduction to Exception Handling: `try` and `except` Blocks

Up to this point, our scripts have followed a "happy path." We assume the user will enter the correct type of data, the files we want to read will always exist, and we'll never divide by zero. But in the real world, things go wrong. Network connections fail, files are moved, and users enter invalid input.