[python]
我有一个多阶段的字典。我想访问dict-list中的位置,并将其替换为列表data
和data_result
。我能够访问该位置并将值附加到变量。但是,我不知道如何创建一个存储整个dict-list和替换/追加列表的变量。
多阶段结构,侧重于data
和results
列表
注意:所有参数都设置为一个值。
data = {
"uuid": str(uuid),
"name": str(tag + "_" + testName + "_" + str(datetime.datetime.utcnow())),
"verdict": str(totalResult)
}
print(data)
data_result = {
"Test_Case": str(Test_Case),
"Test_Result": str(result),
"Time Evaluation": str(duration)
}
res = tcm_template ## ** HERE **
res2 = tcm_template['testcatalogmanager']['ut']['tests']
for res3 in res2:
res4 = res3['data']
for res5 in res4: # # res4 in data list
final_result = res5['results']
final_result.append(data_result)
#tcm_template.replace(data) ## @ data - prototype code
#tcm_template.append(final_result) ## @ results - prototype code