I have a list that have different length in each dimension like below:
list1=[[2,3,4],[1],[77,8,27,12],[25,15]]
and I have another list wit
If you want to process them in a loop, you can just do this:
list1=[[2,3,4],[1],[77,8,27,12],[25,15]]
list2=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"]
last = 0
for ele in list1:
print(ele, list2[last : last + len(ele)])
last += len(ele)
Result:
([2, 3, 4], ['a', 'b', 'c'])
([1], ['d'])
([77, 8, 27, 12], ['e', 'f', 'g', 'h'])
([25, 15], ['i', 'j'])