Python Dictionary type() Method
Description
The Python dictionary type() function returns the type of the input variable. If the variable is a dictionary, it returns the dictionary type.
Syntax
type() method syntax:
type(dict)
Parameters
- dict -- Dictionary.
Return Value
Returns the type of the input variable.
Example
The following example demonstrates how to use the type() function:
Example
#!/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)
The output of the above example is:
Variable Type : <type 'dict'>Other Extensions
Python Dictionary