Skip to content

Instantly share code, notes, and snippets.

View neuromaancer's full-sized avatar
🎯
Focusing

Alafate neuromaancer

🎯
Focusing
View GitHub Profile
@neuromaancer
neuromaancer / tree.md
Last active September 6, 2019 13:43 — forked from upsuper/tree.md
一行 Python 实现树

一行 Python 实现树

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

def tree(): return defaultdict(tree)

就是这样!