Answers for "2 list into dictionary"

23

create dictionary python 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 "2 list into dictionary"

Python Answers by Framework

Browse Popular Code Answers by Language