Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python Dictionary values() method

Python Dictionary values() method

Python Dictionary Python Dictionary


Description

The Python Dictionary values() function returns a list of all the values in a dictionary.

Syntax

values() method syntax:



dict.values()

Parameters

Return Value

Returns all the values in the dictionary.

Example

The following example shows how to use the values() function:

Example

#!/usr/bin/python

tinydict

=

{

'Name'

:

'Runoob'

,

'Age'

:

7

}

print

"Value : %s"

%  tinydict.

values

(

)

The output of the above example is:



Value : [7, 'Runoob']

Python Dictionary Python Dictionary