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

相关文章:

  • 2022-12-23
  • 2021-08-10
  • 2022-12-23
  • 2021-08-07
  • 2022-01-05
  • 2022-01-05
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2021-10-15
  • 2021-08-06
  • 2021-10-11
相关资源
相似解决方案