无涯教程-Python - type(variable)函数

69 阅读1分钟

Python dict type()返回传递的变量的类型。如果传递的变量是DICTIONARY,那么它将返回字典类型。

type(variable) - 语法

type(dict)
  • dict  -  这是字典。

type(variable) - 返回值

此方法返回传递的变量的类型。

type(variable) - 示例

以下示例显示type()方法的用法。

#!/usr/bin/python

dict={Name: Learnfk, Age: 7}; print "Variable Type : %s" % type (dict)

当无涯教程运行上面的程序时,它产生以下输出-

Variable Type : <type dict>

参考链接

www.learnfk.com/python/dict…