Insert multiple items at multiple Indexs in multiple nested lists


#1

As the title says I need to insert multiple items at multiple indexs in multiple nested lists. I have worked out one way to do this, see below and trying to work out how to do this with a code block and applicators but yet to get it to work in the same way, any though on what I need to edit in the code block. Note: I have Used text to explain how ! want to weave/insert the numbers to better show the outcome i want than the coordinate points I am using.Insert Items Question


#2

I would like to piggyback on this topic because I’m after the same result.
I believe the solution will be similar to what @jostein_olsen provided here:
(Getting Combinations from Varying List Lengths):


The insertmultiple solution from @Mostafa_El_Ayoubi did not give the right result for me either, unfortunately.


#3

please post the data you have in the code blocks


#4

Example Code Block:
{{“a1”,“a2”,“a3”,“a4”,“a5”},{“b1”,“b2”},{“c1”,“c2”,“c3”,“c4”},{“d1”,“d2”,“d3”}};
{{“A1”},{“C1”,“C2”}};
{0,2};
Desired Result:
{{“A1”,“a1”,“a2”,“a3”,“a4”,“a5”},{“b1”,“b2”},{“C1”,“C2”,“c1”,“c2”,“c3”,“c4”},{“d1”,“d2”,“d3”}};


#5

You could try this:

for i,j in zip(IN[2],IN[1]):
	IN[0][i].insert(0, j)
	
OUT=IN[0]

#6

That has definitely worked for me! Much appreciated!


#7

Please mark the topic as solved :grinning: