Python 3 - 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.

#!/usr/bin/python3

dict = {'Sex': 'female', 'Age': 7, 'Name': 'Zara'}
print ("Values : ",  list(dict.values()))

Result

When we run above program, it produces the following result −

Values :  ['female', 7, 'Zara']
python_dictionary.htm
Advertisements