Python type()関数
例
これらのオブジェクトのタイプを返します。
a = ('apple', 'banana', 'cherry')
b = "Hello World"
c = 33
x =
type(a)
y = type(b)
z = type(c)
定義と使用法
このtype()
関数は、指定されたオブジェクトのタイプを返します
構文
type(object,
bases, dict)
パラメータ値
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 |