Home  >  Article  >  Backend Development  >  Detailed tutorial on using values() in Python

Detailed tutorial on using values() in Python

零下一度
零下一度Original
2017-05-25 11:15:515847browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn