I have three lists, the first is a list of names, the second is a list of dictionaries, and the third is a list of data. Each position in a list corresponds with the same positions in the other lists. List_1[0] has corresponding data in List_2[0] and List_3[0], etc. I would like to turn these three lists into a dictionary inside a dictionary, with the values in List_1 being the primary keys. How do I do this while keeping everything in order?
Share
See the documentation for more info on
zip.As lionbest points out below, you might want to look at
itertools.izip()if your input data is large.izipdoes essentially the same thing aszip, but it creates iterators instead of lists. This way, you don’t create large temporary lists before creating the dictionary.