RosettaCodeData/Task/Flow-control-structures/Python/flow-control-structures-5.py

7 lines
198 B
Python

try:
temp = 0/0
# here, 'except' catches a specific type of error raised within the try block.
except ZeroDivisionError:
print "You've divided by zero!"
# Output : "You've divided by zero!"