如何将dictdict = [{'a':'1','b':'2','c':'3'},{'a':'1','b':'2','c':'3'}]转换转换成_dict?_dict = {'a':['1','1'], 'b':['2','2'], 'c':['3','3']}**
1 回答
慕仙森
TA贡献1827条经验 获得超7个赞
cc = {}
dict = [{'a':'1','b':'2','c':'3'},{'a':'1','b':'2','c':'3'}]
for i in dict:
for k, v in i.items(): if k not in cc: cc[k] = [v] else: cc[k].append(v)
print(cc)
添加回答
举报
0/150
提交
取消