Python type() Function

Returns the type of an object.

Syntax

Python
type(object)

Parameters

ParameterDescription
object Required. The object for which you wish to find the type

Example

Python
# Some examples of the type() function

integer = 5
float = 3.14
string = "Hello"
myList = ['a', 'b', 'c']
dictionary = {'apples': 5, 'oranges': 3}

print(type(integer))
print(type(float))
print(type(string))
print(type(myList))
print(type(dictionary))

Output

<class 'int'>
<class 'float'>
<class 'str'>
<class 'list'>
<class 'dict'>