I have a list with N items, and I slice it with a specific step, say 3:
slice0 = text[0::3]
slice1 = text[1::3]
slice2 = text[2::3]
After doing a separate processing, now I will need to combine them back in the same positions that were in the original list. Is there a similar (simple) way to do this?
Example:
L = [1,2,3,4,5,6] -> L0 = [1,4], L1 = [2,5], L2 = [3,6]
Then some processing (for example, multiply each list by 1, 2, and 3, respectively:
L0 = [1,4], L1 = [4,10], L2 = [9,18]
Drain them back to their original position.
L = [1,4,9,4,10,18]
Thank.
source
share