Python type() Function
Instance
Returns the type of these objects:
a = ('apple', 'banana', 'cherry') b = "Hello World" c = 55 x = type(a) y = type(b) z = type(c)
Definition and Usage
The type() function returns the type of the specified object.
Syntax
type(object, bases, dict)
Parameter Value
Parameter | Description |
---|---|
object | Required. If only one parameter is set, the type() function will return the type of this object. |
bases | Optional. Specifies the base class. |
dict | Optional. Specifies the namespace with class definitions. |