深度递归查找所有数据
2020-09-25 本文已影响0人
领带衬有黄金
def deep(x, y=None):
if y is None:
y = [x]
for i in x.children:
y.append(i)
deep(i, y)
return y
用于数据结构为自关联的
def deep(x, y=None):
if y is None:
y = [x]
for i in x.children:
y.append(i)
deep(i, y)
return y
用于数据结构为自关联的