我的数据如下。
[
{
"id" : "123",
"type" : "process",
"entity" : "abc"
},
{
"id" : "456",
"type" : "product",
"entity" : "ab"
}
]
我正在循环遍历以下内容以获取id和实体
for test in serializer.data:
qaResultUnique['id'] = test['id']
qaResultUnique['entity'] = test['entity']
uniqueList.append(qaResultUnique)
但是得到错误的输出,每次只收到第二个字典。
[
{
"id" : "456",
"entity" : "ab"
},
{
"id" : "456",
"entity" : "ab"
}
]
我做错了什么,请帮忙。