Choose the list contents you need: list(d) makes a list of keys, list(d.values()) makes a list of values, and list(d.items()) makes a list of (key, value) tuples.
Choose what the list should contain
For a dictionary such as d = {"a": 1, "b": 2}, use the form that matches the result you want:
| Output | Python | Result |
|---|---|---|
| Keys | list(d) |
['a', 'b'] |
| Values | list(d.values()) |
[1, 2] |
| Key-value pairs | list(d.items()) |
[('a', 1), ('b', 2)] |
Keys: list(d)
Iterating over a dictionary yields its keys, so list(d) is the concise way to create a list of them. list(d.keys()) produces the same result, but is usually unnecessary. Python’s data-structures tutorial documents both the key behavior and the sorted-key alternative.
Values: list(d.values())
The values() method provides a view of the dictionary’s values; passing it to list() materializes those values as a list. Values remain in the order associated with their keys.
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
#1 Best Overall
Pairs: list(d.items())
The items() method provides a view of the key-value pairs. Converting it to a list gives one two-element tuple per dictionary entry, which is useful when later code needs both the key and its value.
Understand the order of the result
For Python 3.7 and later, dictionaries preserve insertion order as a language guarantee. These conversions therefore follow the dictionary’s current order. In CPython 3.6, insertion order was preserved as an implementation detail, not guaranteed by the language. The built-in types reference documents the version distinction.
Rank #2
Changing the value of an existing key does not move it. If a key is deleted and then inserted again, it appears at the end of the order. This behavior is specified in Python’s data model reference.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Sort keys when order should be alphabetical
Use sorted(d) to get a list of keys in sorted order rather than insertion order. Sorting requires the keys to be comparable with one another; for example, a mix of incomparable types can cause sorting to fail. Python’s tutorial section on data structures notes that not all values can be compared or sorted.
Recommended Free Tools
sorted(d) sorts the keys, not the values or pairs. If you need a different output shape, first decide which elements belong in the list; sorting is a separate choice from converting.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




