Converting two lists to a list of dictionaries in Python
dictionary, list, python, python-2.7
Solution
It's a one-liner:
dict(zip(S, L))
Problem
I have two lists for example like this: ``` L = [1, 2] S = ['B', 'C'] ``` How can I get them to be combined into a dictionary like this: ``` X = {'B': 1, 'C': 2} ``` The lists will always be the same length, but can have any amount of items.