【发布时间】:2011-07-23 10:18:58
【问题描述】:
伙计们,我已经编写了一段代码来给出输出。现在,这是一个尝试。现在我想以一种审美的方式展示。有人帮帮我。我的表示应该是这样的http://en.wikipedia.org/wiki/File:Trie_example.svg
但我想要的是如何将这个巨大的怪物输出转换为像这样的整洁输出 [(1,2), (1,3), (1,4), (3,4)] ????
defaultdict(<type 'int'>, {'A': 1, 'W': 12})
defaultdict(<type 'int'>, {'A': 2, 'X': 25})
defaultdict(<type 'int'>, {'A': 3})
defaultdict(<type 'int'>, {'A': 4})
defaultdict(<type 'int'>, {'S': 5})
defaultdict(<type 'int'>, {'S': 6})
defaultdict(<type 'int'>, {'S': 7})
defaultdict(<type 'int'>, {'D': 8})
defaultdict(<type 'int'>, {'D': 9})
defaultdict(<type 'int'>, {'D': 10})
defaultdict(<type 'int'>, {'D': 11})
defaultdict(<type 'int'>, {})
defaultdict(<type 'int'>, {'R': 16, 'E': 13, 'F': 19})
defaultdict(<type 'int'>, {'E': 14})
defaultdict(<type 'int'>, {'E': 15})
defaultdict(<type 'int'>, {})
defaultdict(<type 'int'>, {'R': 17})
defaultdict(<type 'int'>, {'T': 18})
defaultdict(<type 'int'>, {})
defaultdict(<type 'int'>, {'F': 20})
defaultdict(<type 'int'>, {'F': 21})
defaultdict(<type 'int'>, {'D': 22})
defaultdict(<type 'int'>, {'D': 23})
defaultdict(<type 'int'>, {'D': 24})
defaultdict(<type 'int'>, {})
defaultdict(<type 'int'>, {'C': 26})
defaultdict(<type 'int'>, {'C': 27})
defaultdict(<type 'int'>, {'V': 28})
defaultdict(<type 'int'>, {'S': 29})
defaultdict(<type 'int'>, {})
【问题讨论】:
-
我得到了代表部分。但我想要的是如何将这个巨大的怪物输出转换为像这样的整洁输出 [(1,2), (1,3), (1,4), (3,4)] ????
标签: python dictionary trie