Python dictionary items() method
Python Dictionary items() Method
Description
The following is the syntax of the items() method:
items() method syntax is as follows:
dict.items()
Parameters
NA
Return Value
This method returns a list of tuple pairs.
Example
The following example demonstrates the use of the items() method.
dict = {'Name': 'Zara', 'Age': 7}
print "Value : %s" % dict.items()
When we run the above program, it produces the following output –
Value : [('Age', 7), ('Name', 'Zara')]