使用python中的多个列表动态创建树图

时间:2018-06-22 16:22:24

标签: python list tree

我想从python中的多个列表创建树形图。

我有4个列表。

list1[]  # list 1 is the root node
list2[]  # list 2 contains response data got by sending a value in list 1
list3[]  # list 3 contains response data got by sending a value in list 2
list4[]  # list 4 is the last node

所有列表都是一维的。

父节点中的每个元素都由其自己的列表组成。

list1[0] will have it's own list2[] data
list1[1] will have it's own list2[] data
list1[2] will have it's own list2[] data

以此类推。

类似地,

list2[0] will have it's own list3[] data
list2[1] will have it's own list3[] data
list2[2] will have it's own list3[] data

以此类推。

list3[]也一样。

I want to create a tree dynamically like this image

每个级别的列表长度相同。

ie. list2 retured by list1[0] and list1[1] will be of same length.

0 个答案:

没有答案