I have a list, to make it easier to understand it's structure I'll write it out like so:
mylist = [[["a","b","c","d"]...]...]
Where the ... means the previous list is repeated (although the values inside may change)
An example list would be:
mylist = [[["a","b","c","d"], ["e","f","g","h"]], [["i", "j", "k", "l"]], [["m","n","o","p"], ["q","r","s","t"]]]
My current method is:
mylist2 = []
for a in mylist[0]:
for b in mylist[1]:
for c in mylist[2]:
mylist2.append([a,b,c])
However this is very long, especially since in my actual code it goes on up to for x in mylist[35]
Is there a better way for me to write this code?
.. this is very long..- did you mean it takes a long time to execute? Will you be usingmylist2more than once?mylist2is returned from the function as soon as it is found