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'>