How to Get All the Values of a Dictionary in Python with values()
A dictionary pairs keys with values, and sometimes you only want the values: every amount in stock, every score in a game. values() gives you all of them at once, ready to add up, loop over or turn into a list. This guide does all three on Python 3.15.2.
Syntax
<values> = <dictionary>.values()
| Part | What it means |
|---|---|
<dictionary> | Any dictionary |
values() | Returns a view of the values, in the dictionary's order |
The built-in types reference says values() will "Return a new view of the dictionary's values."
The Example
A shop's stock maps each item to how many are left: helmets, locks and lights. The script prints the values, their total and the values as a list.
Prerequisites
- uv and Python 3. This guide uses uv 0.13.10 with Python 3.15.2, in a project made with
uv init.
Step 1: Write the Script
stock = {"helmets": 4, "locks": 9, "lights": 6}
print(stock.values())
print(sum(stock.values()))
print(list(stock.values()))

Step 2: Run It
uv run python values.py
dict_values([4, 9, 6])
19
[4, 9, 6]
![The terminal after uv run python values.py: dict_values([4, 9, 6]), then 19, then [4, 9, 6].](https://strdewiridedevblogsprod.blob.core.windows.net/images/blog/programming/python/2026/python-dict-values-02-output.webp)
values() returned a dict_values view of 4, 9 and 6, in the order the keys were added. sum added them up to 19, and list copied them into a plain list. The command works unchanged in PowerShell.
A View, Not a Copy
The view follows the dictionary. Taking amounts = stock.values() from a two-item dictionary, then adding stock["lights"] = 6, and printing amounts afterwards showed the new value too:
dict_values([4, 9, 6])
Common Mistakes
| Mistake | What happens | Do this instead |
|---|---|---|
Taking an item by position: stock.values()[0] | TypeError: 'dict_values' object is not subscriptable | Turn it into a list first: list(stock.values())[0] |
| Expecting a copy that stays the same | The view shows later changes to the dictionary | Use list(stock.values()) for a fixed copy |
Troubleshooting
| Symptom | Likely cause | Fix |
|---|---|---|
'dict_values' object is not subscriptable | [ ] used on the view | Wrap it in list() |
FAQ
How do I get the keys or both?
keys() returns the keys, and items() returns key and value pairs; both are views like values().
Can I loop over it?
Yes: for amount in stock.values(): goes through 4, 9 and 6.
Conclusion
stock.values() returned all three amounts as a view that sum added up to 19 and list turned into [4, 9, 6]. Wrap it in list() when you need positions or a copy that doesn't change.
Additional Resources
- dict.values — the reference.
- Dictionary view objects — how views follow their dictionary.
