Python3 dictionary values () method
description
Python dictionary values () method returns a list of all the values in the dictionary.
grammar
values () method syntax:
dict.values()
parameter
- NA.
return value
Returns all values in the dictionary.
Examples
The following example shows the values () method to use:
#!/usr/bin/python3 dict = {'Sex': 'female', 'Age': 7, 'Name': 'Zara'} print ("字典所有值为 : ", list(dict.values()))
The above example output is:
字典所有值为 : ['female', 'Zara', 7]