Recently, in a Python webinar, someone asked me a question about covering a dictionary to list. After researching and testing, I found a few effective ways to accomplish this task. In this tutorial, I will explain how to convert a dictionary to a list in Python with suitable examples and screenshots.
Dictionaries in Python
Before getting into the conversion process, it’s important to understand what a dictionary is in Python. A dictionary is an unordered collection of items that store data in key-value pairs. For instance, consider the following dictionary that holds information about some popular American cities:
cities = {
'New York': 'NY',
'Los Angeles': 'CA',
'Chicago': 'IL',
'Houston': 'TX',
'Phoenix': 'AZ'
}In this example, the city names serve as keys, while their corresponding state abbreviations are the values.
Read How to Randomly Select from a List in Python?
Convert a Dictionary to a List in Python
There are several ways to convert a dictionary to a list in Python. Below, I will outline the most common methods, complete with examples.
1. Convert Keys to a List
If you only need the keys from a Python dictionary, you can easily convert them to a list using the keys() method. Here’s how:
city_keys = list(cities.keys())
print(city_keys)Output:
['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix']You can see the output in the screenshot below.

Check out How to Get the Index of an Element in a List in Python?
2. Convert Values to a List
In some cases, you may want to extract just the values. You can achieve this using the Python values() following method:
city_values = list(cities.values())
print(city_values)Output:
['NY', 'CA', 'IL', 'TX', 'AZ']You can see the output in the screenshot below.

Read How to Merge Lists Without Duplicates in Python?
3. Convert Key-Value Pairs to a List of Tuples
If you want to retain both keys and values, you can convert the dictionary into a list of tuples using the items() method in Python. This method is particularly useful when you need to process both the keys and values together.
city_items = list(cities.items())
print(city_items)Output:
[('New York', 'NY'), ('Los Angeles', 'CA'), ('Chicago', 'IL'), ('Houston', 'TX'), ('Phoenix', 'AZ')]You can see the output in the screenshot below.

Check out How to Convert String to List in Python?
4. Use List Comprehensions
Python list comprehensions provide a concise way to create lists. You can use them to convert dictionary items into a list format that suits your needs. Here are some examples:
Example: List of City Names
city_list = [city for city in cities]
print(city_list)Output:
['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix']Example: List of State Abbreviations
state_list = [state for state in cities.values()]
print(state_list)Output:
['NY', 'CA', 'IL', 'TX', 'AZ']Read Convert String to List in Python Without Using Split
5. Create a List of Custom Objects
Sometimes, you might want to convert a dictionary to a list in Python of custom objects. For instance, if you have a dictionary of cities with their populations, you can create a list of city objects.
class City:
def __init__(self, name, state, population):
self.name = name
self.state = state
self.population = population
cities_with_population = {
'New York': {'state': 'NY', 'population': 8419600},
'Los Angeles': {'state': 'CA', 'population': 3980400},
'Chicago': {'state': 'IL', 'population': 2716000},
}
city_objects = [
City(name, info['state'], info['population'])
for name, info in cities_with_population.items()
]
for city in city_objects:
print(f"{city.name}, {city.state}: {city.population}")Output:
New York, NY: 8419600
Los Angeles, CA: 3980400
Chicago, IL: 2716000Check out How to Iterate Through a List in Python?
Handle Nested Dictionaries
When dealing with nested dictionaries, the conversion process may require a bit more complexity. For example, consider a dictionary that contains information about various cities, including their neighborhoods:
city_data = {
'New York': {
'state': 'NY',
'neighborhoods': ['Manhattan', 'Brooklyn', 'Queens']
},
'Los Angeles': {
'state': 'CA',
'neighborhoods': ['Hollywood', 'Beverly Hills', 'Santa Monica']
}
}To convert this nested dictionary into a list of neighborhoods, you can use a nested list comprehension:
neighborhoods = [
neighborhood
for city in city_data.values()
for neighborhood in city['neighborhoods']
]
print(neighborhoods)Output:
['Manhattan', 'Brooklyn', 'Queens', 'Hollywood', 'Beverly Hills', 'Santa Monica']Check out How to Write a List to a File in Python?
Conclusion
In this article, I explained how to convert a dictionary to a list in Python. I discussed converting keys to a list , converting values to a list , converting key-value pairs to a list of tuples, using list comprehension, and creating a list of custom objects. I also covered how to handle nested dictionaries.
You may read:
- How to Select Items from a List in Python?
- How to Add Tuples to Lists in Python?
- How to Convert Dictionary to List of Tuples in Python?

I am Bijay Kumar, a Microsoft MVP in SharePoint. Apart from SharePoint, I started working on Python, Machine learning, and artificial intelligence for the last 5 years. During this time I got expertise in various Python libraries also like Tkinter, Pandas, NumPy, Turtle, Django, Matplotlib, Tensorflow, Scipy, Scikit-Learn, etc… for various clients in the United States, Canada, the United Kingdom, Australia, New Zealand, etc. Check out my profile.