Answers for "how to convert a dictionary of two elements to list"

23

dict from two lists

>>> keys = ['a', 'b', 'c']
>>> values = [1, 2, 3]
>>> dictionary = dict(zip(keys, values))
>>> print(dictionary)
{'a': 1, 'b': 2, 'c': 3}
Posted by: Guest on May-21-2020
0

2 liste to a dictionary

d = {}
for i in list1:
    for j in list2:
        d[i] = j
print d
Posted by: Guest on August-07-2021

Code answers related to "how to convert a dictionary of two elements to list"

Python Answers by Framework

Browse Popular Code Answers by Language