Python dictionary values() Method
Advertisements
Description
The method values() returns a list of all the values available in a given dictionary.
Syntax
Following is the syntax for values() method −
dict.values()
Parameters
NA
Return Value
This method returns a list of all the values available in a given dictionary.
Example
The following example shows the usage of values() method.
Live Demo#!/usr/bin/python dict = {'Name': 'Zara', 'Age': 7} print "Value : %s" % dict.values()
When we run above program, it produces following result −
Value : [7, 'Zara']
python_dictionary.htm
Advertisements