Python type() function

Instance

Return the types of these objects:

a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 55
x = type(a)
y = type(b)
z = type(c)

Running an instance

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. Specify the base class.
dict Optional. Specify the namespace with class definitions.