Python Dictionary values() Method

Python 字典Python Dictionary


Description

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

Syntax

The syntax of the values() method is:

dict.values()

Parameters

  • NA。

Return Value

Returns all values in the dictionary.

Example

The following example demonstrates the usage of the values() function:

Example

#!/usr/bin/python

tinydict = {'Name': 'Example', 'Age': 7}

print "Value : %s" %  tinydict.values()

The output of the above example is:

Value : [7, 'Example']

Python 字典Python Dictionary

Other Extensions