Python dictionary values() method

Python Dictionary values() Method

Description

The Python dictionary method values() returns a list of all available values in the given dictionary.

Syntax

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 demonstrates the use of the values() method.

dict = {'Name': 'Zara', 'Age': 7}
print "Value : %s" % dict.values()

When we run the above program, it produces the following output –

Value : [7, 'Zara']

Leave a Reply

Your email address will not be published. Required fields are marked *