Python3---常见函数---type()


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


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM