码迷,mamicode.com
首页 > 编程语言 > 详细

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

时间:2020-01-02 15:26:33      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:dict   pre   name   type   with   pts   ase   0x03   code   

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()

标签:dict   pre   name   type   with   pts   ase   0x03   code   

原文地址:https://www.cnblogs.com/aaron456-rgv/p/12132885.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!