Built-in Functions
type()
Find out what type of value an object is.
type(object)
type() tells you the class or built-in type of a value.
This is useful when you are checking what kind of data your code is handling.
Arguments
Parameters
| Name | Description |
|---|---|
| object | The value whose type you want to inspect. |
Result
Returns
The object's type.
Run it
Try it
Run it and change it
value = [1, 2] print(type(value).__name__)
Output
Press Run to see what it prints.