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 Tue Feb 27 14:07:12 2024.
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