Skip to content

Instantly share code, notes, and snippets.

@blluv
Created May 25, 2023 02:34
Show Gist options
  • Save blluv/5edcd3913f291a882acfb90109b5ff4f to your computer and use it in GitHub Desktop.
Save blluv/5edcd3913f291a882acfb90109b5ff4f to your computer and use it in GitHub Desktop.
def printTree(tree, parentIdx=None, depth=0):
nodes = filter(lambda t: t["parentIdx"] == parentIdx, tree)
for node in nodes:
print("\t" * depth, node["name"], sep="")
printTree(tree, node["idx"], depth + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment