Python: how to handle exceptions using try-except blocks?

Example:

value = int("text")
Exceptions are events that can modify the flow of control through a program.

Solution:

try: value = int("text") except ValueError: print("That's not an int!")

Beginner's Guide to Python