Do these 3 things before closing this tab:
1Repair Windows errors before they cause bigger problems2Fix the driver behind crashes, sound loss and screen glitches3Clear out junk files and repair common Windows errorsUse list(my_dict.items()) to turn a Python dictionary into a list of (key, value) tuples. For example, {"apple": 3, "banana": 5} becomes [('apple', 3), ('banana', 5)].
Convert a dictionary to key-value tuples
The dictionary method .items() provides a view of its (key, value) pairs. Wrapping that view in list() creates a list containing those pairs:
As an Amazon Associate I earn from qualifying purchases.
my_dict = {"apple": 3, "banana": 5}
pairs = list(my_dict.items())
print(pairs)
# [('apple', 3), ('banana', 5)]
The official Python Built-in Types reference defines dict.items() as returning “a new view of the dictionary’s items ((key, value) pairs).”
Why not use list(my_dict)?
Iterating over a dictionary directly yields its keys, so list(my_dict) returns a list of keys—not key-value tuples. Use .items() when each element needs both the key and its value.
#1 Best Overall
keys = list(my_dict) # ['apple', 'banana']
pairs = list(my_dict.items()) # [('apple', 3), ('banana', 5)]
What order will the tuples have?
For Python 3.7 and later, dictionary iteration order is guaranteed to match insertion order, so the list follows the order in which entries were added. Python 3.6 had this behavior in CPython as an implementation detail, but it was not yet a language guarantee. The Python documentation explains the distinction in its Functional Programming HOWTO.
Choose a different output when needed
Get only keys or values
list(my_dict)returns the keys.list(my_dict.values())returns the values.
Reverse each tuple
To make each tuple (value, key) instead, unpack each item and rebuild it in the desired order:
Rank #2
value_key_pairs = [(value, key) for key, value in my_dict.items()]
Sort the pairs
The basic conversion preserves dictionary iteration order; it does not sort the results. Use sorted() when you want a sorted list:
PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchsorted_pairs = sorted(my_dict.items()) # Sort by key
by_value = sorted(my_dict.items(), key=lambda item: item[1])
The first example sorts by key using the pairs’ natural ordering. The second explicitly sorts by each pair’s value.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.View versus list: when to materialize the pairs
my_dict.items() returns a dynamic view, not a list. The view reflects changes to the dictionary; list(my_dict.items()) creates a materialized list of pairs at the time of conversion. If you need a standalone list to pass elsewhere or modify independently, use list().
Avoid adding or deleting dictionary entries while iterating over an items view. Such changes may raise RuntimeError or cause the iteration not to cover every entry. If you need to change the dictionary while processing its entries, iterate over a list made beforehand, such as list(my_dict.items()).
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.




