我有以下词典:d = {s: {0:{'n','s'}, 1:{'s'} }}
如何尽可能缩短{'n','s'}(set)
到['n','s']
的值。
因为我必须以0:['n','s'], 1:['s']
答案 0 :(得分:0)
就这样做:
for key, value in d['s'].iteritems():
d['s'][key] = list(d['s'][key])
print d
输入:
d = {s: {0:{'n','s'}, 1:{'s'} }}
输出:
{'s': {0: ['s', 'n'], 1: ['s']}}