THE WORLD'S LARGEST WEB DEVELOPER SITE

Python type() Function

❮ Built-in Functions


Example

Return the type of these objects:

a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 33

x = type(a)
y = type(b)
z = type(c)
Run example »

Definition and Usage

The type() function returns the type of the specified object


Syntax

type(object, bases, dict)

Parameter Values

Parameter Description
object Required. If only one parameter is specified, the type() function returns the type of this object
bases Optional. Specifies the base classes
dict Optional. Specifies the namespace with the definition for the class

❮ Built-in Functions