Python3---常见函数---type(),,0X01;功能描述
Python3---常见函数---type(),,0X01;功能描述
0X01;功能描述
type() 函数如果你只有第一个参数则返回对象的类型,三个参数返回新的类型对象。
0X02;语法:
type(object)
type(name,bases,dict)
name -- 类的名称。bases -- 基类的元组。dict -- 字典,类内定义的命名空间变量。0X03;举例:
1 print(type(1))2 print(type(‘1‘))3 print(type([2]))
#运行结果:C:\Users\aaron\Desktop\Pytoon-cade\venv\Scripts\python.exe C:/Users/aaron/Desktop/Pytoon-cade/urllib-Study.py<class ‘int‘><class ‘str‘><class ‘list‘>Process finished with exit code 0
Python3---常见函数---type()
评论关闭