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

Detailed tutorial on using values() in Python

零下一度
Release: 2017-05-25 11:15:51
Original
5891 people have browsed it

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()
Copy after login

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()
Copy after login

When we run the above program, it will produce the following results:

Value : [7, 'Zara']
Copy after login

[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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template