TUTORIAL编程语言与算法FETCHED
Python 字典(Dictionary) type()方法
Python 字典(Dictionary) type()方法 Python 字典 描述 Python 字典(Dictionary) type() 函数返回输入的变量类型,如果变量是字典就返回字典类型。 语法 type()方法语法: type(dict) 参数 dict -- 字典。 返回值 返回输入的变量类型。 实例 以下实例展示了 type()函数的使用方法: 实例 [mycode4 type='pytho..
更新于 2026/7/16
教程详情页默认 noindex。
Python 字典(Dictionary) type()方法
描述
Python 字典(Dictionary) type() 函数返回输入的变量类型,如果变量是字典就返回字典类型。
语法
type()方法语法:
type(dict)
参数
- dict -- 字典。
返回值
返回输入的变量类型。
实例
以下实例展示了 type()函数的使用方法:
实例
#!/usr/bin/python
tinydict = {'Name': 'Zara', 'Age': 7};
print "Variable Type : %s" % type (tinydict)
tinydict = {'Name': 'Zara', 'Age': 7};
print "Variable Type : %s" % type (tinydict)
以上实例输出结果为:
Variable Type : <type 'dict'>
Python 字典