Python dictionary technique items() revisits a catalog of dict's (key, value) Tuple pairs. In Python Dictionary, items () way is utilized to revisit the list with entire dictionary keys with worth. Parameters: This system takes no parameters. Returns: A vision object that exhibits a list of a provided dictionary's (key, value) tuple pair. The order of such items in the roll may not always be identical.
Following is the syntax for items() method:
dict.items()
This method returns a list of tuple pairs.
The following example shows the usage of items() method.
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.items()
When we run the above program, it produces the following result:
Value : [('Age', 7), ('Name', 'Zara')]
Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.