我有n个dict,其中包含的值如列表所示
{"1":[{'q': ['Data'], 'q1': '110'}]}
{"2":[{'q2':["other Data"], "q3" : "exp"},{'q2':["other Data2"], "q3" : "exp2"}]}
我想要这个的输出格式:-你知道吗
{"1":[{'q': ['Data'], 'q1': '110'}],"2":[{'q2':["other Data"], "q3" : "exp"}]}
{"2":{'q2':["other Data2"], "q3" : "exp2"}
意味着zip或者我们可以分割dict键的基础,如果存在的话,只为每个键添加一个值。你知道吗
dict1.update(dict2)
对你有用吗?这将用dict2
中的值更新dict1
。你知道吗编辑:
这可能有用:
这给了我:
相关问题 更多 >
编程相关推荐