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)
参数值
参数 | 描述 |
---|---|
object | 任何对象 |
bases | 基类的元组。 |
dict | 字典,类内定义的命名空间变量。 |