Grasshopper python question DataTree with integer

Hello all,

I’m wondering to know how to define integer,float,strings in python DataTree construction?
For instance, I was trying to put a integer in a tree, but what syntax should I fill in the "[ ] "
I tried string, Rhino.Geometry, rhinoscriptsyntax, but could’nt find a proper one

import string
import Rhino.Geometry
import rhinoscriptsyntax

myTree = DataTree

Thank you very much!

Here’s a little something about data trees in general, not specific to integers. I just learned this from searching and reading to answer your question, so anyone could do the same? Thanks for the opportunity to learn something I didn’t know.


python_data_tree_2019Jul26a.gh (5.4 KB)

from Grasshopper import DataTree
from Grasshopper.Kernel.Data import GH_Path

aTree = DataTree[object]()

for i1 in range(x):
    branch = []
    for i2 in range(y):
        branch.append((i1+1) * i2)
    aTree.AddRange(branch, GH_Path(i1))

a = aTree

https://developer.rhino3d.com/wip/api/grasshopper/html/Methods_T_Grasshopper_DataTree_1.htm