In Python, the keys() method of the dictionary can return the "keys" list of the dictionary, and the syntax format is "dict.keys()". The keys() method returns all the keys of a dictionary as a list.
#The operating environment of this tutorial: Windows 7 system, Python 2 version, Dell G3 computer.
Python Dictionary keys() method
The keys() method returns all the keys of a dictionary in a list.
Syntax:
1 |
|
Return value: Returns all keys of a dictionary.
Example:
1 2 3 |
|
The output result of the above example is:
1 |
|
For more programming-related knowledge, please visit: Programming Learning! !
The above is the detailed content of What method of a dictionary returns a list of keys in the dictionary?. For more information, please follow other related articles on the PHP Chinese website!