Branches with grasshopper python

I have the following example:

list = []
for i in range(0, 10):
    list.append(i+1)
    list.append(i+2)

The first thing im questioning is how to put every loop into a new branch. Now it puts all values into one list, but I want to have every loop in a sepperate list. My second question is, how do I output this as a grasshopper list with branches?

Thanks again!

Greetings

Here’s a simple example:

Also refer to this article,

2 Likes

You may want to try this

import ghpythonlib.treehelpers as th

outer = []

for i in range(0,10):
    inner = []
    inner.append(i)
    inner.append(i+1)
    outer.append(inner)

result = th.list_to_tree(outer)

Thanks! This really helped me out.