type() / isinstance()
Finds/checks the type of a value.
Syntax
type(value) · isinstance(value, type)
Description
type() gives the value's type. isinstance() returns True/False to the question 'is this value of that type?' (preferred for checking).
Example
Loading editor…
Expected output
<class 'int'> True
When to use?
Debugging, verifying whether incoming data is of the expected type.