create dictionary python from two lists

43

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}

create a dict from two lists -

zip_iterator = zip(keys_list, values_list)

Comments

Submit
0 Comments