Files
30-seconds-of-code/snippets/try_else.md
2019-10-11 23:26:36 +02:00

344 B

title, tags
title tags
Try else utility,intermediate

Rises an exception if it is caught in the try block.

You can have an else clause as part of a try/except block, which is executed if no exception is thrown.

try:
    5*6
except TypeError:
    print("An exception was raised")
else:
    print("No exceptions were raised.")