Python. Create Points from item numbers of sublists and remove items and leave the point instead

Hello,

I got a list of sublists, for example in index 4,5,6 I got the coordinates z,y,x and I would like to replace the indexes 4,5,6 by a new item which is a dynamo point composed by those 3 items, that means the 3 indexes removed and the new one added in the original list.

What I got so far is this Python code but it is not looking items inside the sublist, maybe it works with flatten list, not sure

listwithpoint=[]
for xpt,ypt,zpt in zip(list[6],list[5],list[4]):
	listwithpoint.append(Point.ByCoordinates(xpt,ypt,zpt))

OUT=listwithpoint

If you’re supplying a list of sublists then (from the code you’ve shown) you’re only grabbing the sublists and not the specified items within each sublist. You need to go one level deeper into your list structure.

so how to tweek it? sounds very stupid question but I do not have a clue, sometimes I supposed but does not work either

I would suggest taking some more time to understand the Python basics. There’s a lot of good references in the post below.