type() (Python)
type() returns the data type of a value, such as int, str, or list. It is commonly used to inspect or debug what kind of object you're working with.
Python
To check whether a value is a particular type, isinstance(value, Type) is usually preferred over comparing type() directly, because it also handles subclasses.
Examples
Python
print(type(5))
print(type("hi"))
print(type([1, 2]))Output:
<class 'int'>
<class 'str'>
<class 'list'>