Python 3.9 is now generally available.


Raises an exception if value is not a valid integer.

An integer is valid if it's not negative or empty and is an integer (either int or long). The exception type raised can be specified with the exception argument; it defaults to BadValueError.

value The value to validate.
name The name of this value; used in the exception message.
exception The type of exception to raise.
empty_ok Allow None value.
zero_ok Allow zero value.
negative_ok Allow negative value.