Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| /* Go Top */ | |
| .go-top { | |
| position: fixed; | |
| bottom: 2em; | |
| right: 2em; | |
| text-decoration: none; | |
| color: white; | |
| background-color: #f6f6f6; | |
| background-color: rgba(0, 0, 0, 0.3); | |
| font-size: 12px; |
| // ==UserScript== | |
| // @name v2ex novice killer | |
| // @namespace http://shellex.info | |
| // @author shellex(5h3ll3x@gmail.com) | |
| // @description 干掉使用默认头像的人的发言 | |
| // @include http://www.v2ex.com/go/* | |
| // @include http://v2ex.com/go/* | |
| // @include http://www.v2ex.com/?tab=* | |
| // @include http://v2ex.com/?tab=* | |
| // @include http://www.v2ex.com/ |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!