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() |
Cover
Reference
Tutorials
Examples
Bugs