我想使用Python修改這些數(shù)據(jù){ "date":<curdate>, "name":["","",""], "id":[",","]}到{ "date":<currdate>, "inputs":{ "name":["","",""], "id":[",","] }}
1 回答

慕尼黑5688855
TA貢獻(xiàn)1848條經(jīng)驗(yàn) 獲得超2個(gè)贊
只需將字典元素分配給新字典中的適當(dāng)元素即可。
new_dict = { "date": old_dict["date"],
"inputs": {
"name": old_dict["name"],
"id": old_dict["id"]
}
}
添加回答
舉報(bào)
0/150
提交
取消