I have a number of lists that are of equal length, say 4, but this can change. What I want to do is combine these lists, so that the first item of each list, item[0], is combined to form a new list. Similarly with item[1], item[2] etc. This seems simple enough, but how do I make sure that the list names (i.e. slide1) are created dynamically from the first list (list1).
i.e. I want to go from this:
list1 = ['slide1','slide2','slide3','slide4']
list2 = [1,2,3,4]
list3 = ['banana', 'apple', 'pear', 'orange']
to this:
slide1 = ['slide1',1,'banana']
slide2 = ['slide2',2,'apple']
slide3 = ['slide3',3,'pear']
slide4 = ['slide4',4,'orange']
The reason I need to do this is to then subsequently enter these lists into a database. Any clues? I think I know how to do the for loop, but am stuck with the creation of 'dynamic' list names. Should I otherwise use a dictionary?
Thanks in advance for the help!