Python -type() Functie
Voorbeeld
Retourneer het type van deze objecten:
a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 33
x =
type(a)
y = type(b)
z = type(c)
Definitie en gebruik
De type()
functie retourneert het type van het opgegeven object
Syntaxis
type(object,
bases, dict)
Parameterwaarden
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 |