Built-in Exceptions

ZeroDivisionError — exception class

Division, floor division or remainder with a zero divisor fails. Check the divisor before using a default or alternate operation; do not silently turn undefined arithmetic into a plausible numeric value. Catch ZeroDivisionError when this category is the recovery boundary; do not rely on the exact human-readable message.

Formal Syntax & Structure

python syntaxpython
ZeroDivisionError

Return Value

type

The class object ZeroDivisionError; this reference documents the class identity, not a universal constructor signature.

Working Example

Example Snippetpython
try:    7 / 0except ZeroDivisionError as error:    print(type(error).__name__)
Python Reference