Hi
I got this list of items:
And I want to add two entries of 0 at the first 2 indexes of the sublists… But at the best I can only add one 0 at the front. What am I missing?
Hi
I got this list of items:
And I want to add two entries of 0 at the first 2 indexes of the sublists… But at the best I can only add one 0 at the front. What am I missing?
I kinda got it.
Although the result is what I want, feels odd. Is there a better way of getting the same result?
I don’t think there is a better method. Maybe only replacing the List.Flatten node with a List.Normalize node with a 2 as other input.
A Single Python node alternative
The ‘c’ variable ensures that the correct index is used, as using ‘list.index(element)’ will return the first index of an element on the list, making it tricky to deal with duplicates.
The reason it doesn’t work is that you want to add two items to a list. You’re presenting Dynamo with the item [0,0], which, no matter how you use this node, will always be added as just one item.
What you actually want to do is find a way to join two lists.
You can theoretically just use List.Join but I find it doesn’t work that well when it comes to different list levels, but luckily there’s still List.Map
:
Really elegant solutions. Thanks @Ewan_Opie and @PauLtus.