摘要:
import collections s = [('yellow', 1), ('blue', 2), ('yellow', 3), ('blue', 4), ('red', 1)] # defaultdict d = collections.defaultdict(list) for k, v in s: d[k].append(v) # Use dict and setdefault... 阅读全文
posted @ 2016-11-22 20:19
danjialan
阅读(144)
评论(0)
推荐(0)
浙公网安备 33010602011771号