This article mainly introduces the use of the values() method in Python to return the value of the dictionary key. It is the basic knowledge for introductory learning of Python. Friends who need it can refer to it
The values() method returns a list of all available values in the given dictionary.
Syntax
The following is the syntax of the values() method:
dict.values()
Parameters
NA
Return value
This method returns a list of all available values in the given dictionary.
Example
The following example shows the use of values() method.
#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.values()
When we run the above program, it will produce the following results:
Value : [7, 'Zara']
[Related recommendations]
1. Detailed explanation of the use of sort() in Python Method
2. Share the usage example of sort in python
3. Use example of sort_values isin in pandas DataFrame
The above is the detailed content of Detailed tutorial on using values() in Python. For more information, please follow other related articles on the PHP Chinese website!