try:
1 / 0
except ZeroDivisionError or ValueError:
pass
try:
1 / 0
except (ZeroDivisionError, ValueError):
pass
Used when the exception to catch is of the form except A or B
. If
intending to catch multiple, rewrite as except (A, B)
.