Função Python type()
Exemplo
Retorne o tipo desses objetos:
a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 33
x =
type(a)
y = type(b)
z = type(c)
Definição e uso
A type()
função retorna o tipo do objeto especificado
Sintaxe
type(object,
bases, dict)
Valores de parâmetro
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 |