How do I iterate over branches and sub-branches in a tree with python?

When I try to treat the tree as a list and find out its length I get an error that it does not have an attribute length.

I think you might need to use the tree helper functions. This might help?

DataTrees have BranchCount and DataCount properties. There’s no Length property.

1 Like

Yes, I try to use this but I could not fine a way to iterate over the number of branches.

David can you give me an example (could be csharp) iterate, say I have a tree {0,n} I want with code to extract the data from each branch.

e.g.: I have this tree

I successfully get this:

But how can I split back this tree into 4(or as many as they are) lists?

I got it, thanks for your time @chanley, @DavidRutten.

it was simpler than I thought. just 5-6 lines of code