PHP前端开发

什么是Python type 函数?

百变鹏仔 2小时前 #Python
文章标签 函数

今天这篇文章中我们来了解一下python字典函数,在这文章之中我会对python type函数进行说明,以及其的作用进行展示。好了废话不多说,我们开始进入文章吧。

什么是Python type 函数?

描述

Python 字典(Dictionary) type() 函数返回输入的变量类型,如果变量是字典就返回字典类型。

语法

立即学习“Python免费学习笔记(深入)”;

type()方法语法:

type(dict)

参数

dict -- 字典。

返回值

返回输入的变量类型。

Python type 函数使用实例

以下实例展示了 type()函数的使用方法:

#!/usr/bin/pythondict = {'Name': 'Zara', 'Age': 7};print "Variable Type : %s" %  type (dict)

以上实例输出结果为:

Variable Type : <type></type>