Skip to content

Instantly share code, notes, and snippets.

View VillanCh's full-sized avatar
:octocat:
a little of busy for coding

v1ll4n VillanCh

:octocat:
a little of busy for coding
View GitHub Profile
@VillanCh
VillanCh / tree.md
Created January 23, 2018 13:28 — forked from upsuper/tree.md
一行 Python 实现树

一行 Python 实现树

使用 Python 内置的 defaultdict,我们可以很容易的定义一个树形数据结构:

def tree(): return defaultdict(tree)

就是这样!