Description
Python Dictionary (Dictionary) items() function returns a traversable array of (key, value) tuples as a list.
Syntax
items() method syntax:
dict.items()
Parameters
NA.
Return value
Returns a traversable array of (key, value) tuples.
Example
The following example shows how to use the items() function:
#!/usr/bin/pythondict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.items()
The output result of the above example is:
Value : [('Age', 7), ('Name', 'Zara')]
[Related Recommendation】
1. Special recommendation: "php Programmer Toolbox" V0.1 version download
2 . Free video tutorial on Python
3. Example of item() function in Python to traverse a dictionary
##4.Detailed explanation of the usage of items() series functions in Python
5.Introducing three methods of accessing dictionaries
6.Items() method for basic introduction to Python
The above is the detailed content of Basic introduction to Python items() method. For more information, please follow other related articles on the PHP Chinese website!