美文网首页
深度递归查找所有数据

深度递归查找所有数据

作者: 领带衬有黄金 | 来源:发表于2020-09-25 15:40 被阅读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
    

    用于数据结构为自关联的

    相关文章

      网友评论

          本文标题:深度递归查找所有数据

          本文链接:https://www.haomeiwen.com/subject/pvyfuktx.html