dict.values() Values view
Last updated: 2026-09-22
dict.values() Values view
dict.values() returns a view of values.
| Category | Dict Methods |
|---|---|
| Kind | Built-in Type Method |
| Python Version | all |
📝 Syntax
dict.values()
Returns:A dict_values view object yielding all values.
Mutates the original:No (returns a new object)
▶ Example
Edit the code, press Run, and see the result in the output panel:
Output:
[1, 2]
3
💡 Related Cases
More case studies coming soon — check back later.
❓ FAQ
QWhat does values() return?
AA dict_values view object that is iterable; convert it to a list with list(d.values()).
QCan I get a value by index?
ANo! d.values()[0] raises a TypeError; you need list(d.values())[0] first.
QIs the view dynamic?
AYes, changes to the dict content are reflected in the view in real time.
QWhat happens with duplicate values?
Avalues() does not de-duplicate; it returns as many values as the dict has items, including duplicates.