I have these two lists
indexes = [4, 2, 4, 6]
values = [0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3]
I'm looking to merge these lists to be this. Each index value corresponds to the list size of the merge.
[[0, 1, 2, 3], [0, 1], [2, 3, 0, 1], [2, 3, 0, 1, 2, 3]]
The current answer I have for this is okay, but I'm wondering if there's a better method for it.
ids = []
cIndex = 0
for i in indexes:
ids.append([values[cIndex+x] for x in xrange(i)])
cIndex += i