这是一种方法:
In [101]: d = {"one":1, "two":2, "a":1}
In [102]: answer = collections.defaultdict(list)
In [103]: for k,v in d.iteritems():
.....: answer[v].append(k)
.....:
In [104]: answer
Out[104]: defaultdict(<type 'list'>, {1: ['a', 'one'], 2: ['two']})
In [105]: dict(answer)
Out[105]: {1: ['a', 'one'], 2: ['two']}
In [106]: dict((k, tuple(v)) for k,v in answer.iteritems())
Out[106]: {1: ('a', 'one'), 2: ('two',)}
如果你真的想要一个单线(我强烈建议不要这样做 - 它非常低效):
In [110]: d
Out[110]: {'a': 1, 'one': 1, 'two': 2}
In [111]: dict((v, tuple([key for key in d if d[key]==v])) for k,v in d.iteritems())
Out[111]: {1: ('a', 'one'), 2: ('two',)}
希望这可以帮助