I recently faced a situation where I needed to transform a list of employee names into a dictionary with additional information which made me explore more about this topic. In this tutorial, I will explain how to create a dictionary from a list in Python. I will share the different approaches I used to solve this problem, along with code examples.
Create a Dictionary from a List in Python
Let us learn how to create a dictionary from a list in Python.
Read How to Count the Number of Keys in a Python Dictionary?
Method 1. Use a Dictionary Comprehension
One of the most concise ways to convert a list to a dictionary is by using dictionary comprehension in Python. This method allows you to create a dictionary from a list in a single line of code. Here’s an example:
employee_names = ['John', 'Emma', 'Michael', 'Olivia']
employee_dict = {name: None for name in employee_names}
print(employee_dict)Output:
{'John': None, 'Emma': None, 'Michael': None, 'Olivia': None}I executed the above example code and added the screenshot below.

In this example, we have a list of employee names called employee_names. By using dictionary comprehension, we create a new dictionary employee_dict where the keys are the names from the list, and the values are initially set to None. You can replace None with any default value of your choice.
Check out How to Find Python Dictionary Index
Method 2. Use the zip() Function
Another way to convert a list to a dictionary is by using the zip() function along with the dict() constructor in Python. This method is useful when you have separate lists for keys and values. Here’s an example:
keys = ['name', 'age', 'city']
values = ['Liam', 28, 'New York']
employee_dict = dict(zip(keys, values))
print(employee_dict)Output:
{'name': 'Liam', 'age': 28, 'city': 'New York'}I executed the above example code and added the screenshot below.

In this case, we have two lists: keys and values. The keys list contains the desired dictionary keys and the values list contains the corresponding values. By using zip(), we combine the keys and values into pairs, and then we pass the result to the dict() constructor to create the dictionary.
Read How to Check If Two Dictionaries are Equal in Python
Method 3. Use the enumerate() Function
If you want to create a dictionary where the keys are the indices of the list elements, you can use the enumerate() function in Python. This method assigns the list indices as keys and the list elements as values. Here’s an example:
cities = ['Los Angeles', 'Chicago', 'Houston', 'Philadelphia']
city_dict = dict(enumerate(cities))
print(city_dict)Output:
{0: 'Los Angeles', 1: 'Chicago', 2: 'Houston', 3: 'Philadelphia'}I executed the above example code and added the screenshot below.

In this example, we have a list of cities called cities. By using enumerate() and passing the result to dict(), we create a dictionary city_dict where the keys are the indices of the cities in the list, and the values are the corresponding city names.
Check out How to Convert Two Lists into a Dictionary in Python Without Using a built-in Method
Handle Key-Value Pairs
In some cases, you might have a list of key-value pairs that you want to convert into a dictionary. You can achieve this by using a dictionary comprehension or the dict() constructor. Here’s an example:
employee_data = [('name', 'Sophia'), ('age', 35), ('city', 'San Francisco')]
employee_dict = {key: value for key, value in employee_data}
# Alternatively: employee_dict = dict(employee_data)
print(employee_dict)Output:
{'name': 'Sophia', 'age': 35, 'city': 'San Francisco'}In this example, we have a list called employee_data that contains tuples representing key-value pairs. By using a dictionary comprehension or the dict() constructor, we can directly convert this list into a dictionary.
Check out How to Convert a Dictionary to a List in Python?
Conclusion
In this article, I helped you to learn how to create a dictionary from a list in Python. I discussed mainly three methods to achieve this task such as using a dictionary comprehension , using zip() function, and enumerate() function. I also explained how to handle key-value pairs.
You may like to read:
- How to Convert Tuple to Dict in Python?
- How to Convert Dict to String Python
- How to Convert Dict_Values to List 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.