内容简介:Python 字典(Dictionary) type() 函数返回输入的变量类型,如果变量是字典就返回字典类型。
描述
Python 字典(Dictionary) type() 函数返回输入的变量类型,如果变量是字典就返回字典类型。
语法
type()方法语法:
type(dict)
参数
- dict -- 字典。
返回值
返回输入的变量类型。
实例
以下实例展示了 type()函数的使用方法:
#!/usr/bin/python
dict = {'Name': 'Zara', 'Age': 7};
print "Variable Type : %s" % type (dict)以上实例输出结果为:
Variable Type : <type 'dict'>
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网
猜你喜欢:- 【Python—字典的用法】创建字典的3种方法
- Python 字典(Dictionary) cmp()方法
- Python 字典(Dictionary) len()方法
- Python 字典(Dictionary) str()方法
- Python 字典(Dictionary) clear()方法
- Python 字典(Dictionary) copy()方法
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Programming Python
Mark Lutz / O'Reilly Media / 2006-8-30 / USD 59.99
Already the industry standard for Python users, "Programming Python" from O'Reilly just got even better. This third edition has been updated to reflect current best practices and the abundance of chan......一起来看看 《Programming Python》 这本书的介绍吧!