I have a list of tuples that I would like to convert to a dictionary. Each of the tuples in the list has four elements:
N = [('WA', 'OR', 'CA', 'HI'), ('MA', 'NY', 'PA', 'FL')]
How do I get a dictionary set up where the first element of the tuple is the key, and the value is a tuple of the rest of the elements?
dict = {"WA": ("OR", "CA", "HI"), "MA": ("NY", "PA", "FL")}
I tried something along the lines of this, but I am getting a truncated version of the fourth element (at least that what it looks like to me, my actual list is much larger than the example list):
for i in range(len(N))}:
for v in N[i]:
dict[i] = v[1:4]
{key: (*values,) for key, *values in N}
but yours is explicit, so that's better. – Florina