Name | .values() |
||
---|---|---|---|
Examples |
element_names = {'H': 'hydrogen', 'He': 'helium', 'Li': 'lithium'} element_values = element_names.values() print(element_values) # Prints ['lithium', 'hydrogen', 'helium'] # Check to see if a given value is in the dictionary if 'hydrogen' in element_names.values(): print("found hydrogen!") | ||
Description |
Returns a list of all values in the dictionary (without reference to their
keys). Note that because of the nature of the dictionary data structure, the return value of values() will be in arbitrary order. |
||
Syntax | dict.values() | ||
Parameters |
| ||
Related |
Dictionary .keys() |
Updated on Mon Sep 21 15:53:24 2020.
If you see any errors or have comments, please let us know.
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License