Home >Backend Development >Python Tutorial >What can the python keys function do? Example analysis
Because many people don’t know what the built-in functions in the dictionary are? what's the effect? So in this article, I will introduce the relevant knowledge about the python keys function in the python dictionary. What does the keys function mean? What is the function of this function will be discussed in the next article. get the answer.
First of all, let’s talk about what this function can do?
keys function
Python Dictionary (Dictionary) keys() function returns all the keys of a dictionary as a list.
Syntax
keys() method syntax:
dict.keys()
Parameters
Return value
keys function example
The following example shows how to use the keys() function:#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.keys()The output result of the above example is as follows:
Value : ['Age', 'Name']The above is all the content of this article, the built-in keys function of the dictionary in Python. I hope what I said and the examples I gave can be helpful to you. For more related knowledge, please visit the
Python tutorial column on the php Chinese website.
The above is the detailed content of What can the python keys function do? Example analysis. For more information, please follow other related articles on the PHP Chinese website!