def deep(x, y=None): if y is None: y = [x] for i in x.children: y.append(i) deep(i, y) return y 用于数据结构为自关联的