【发布时间】:2020-07-21 20:44:45
【问题描述】:
我有两个字典
${Dict1}={'Test_1': {'l': 307, 'T': 290, 'R': 5785, 'Bo': 4693} ,'Test_2': {'l': 307, 'T': 290, 'R': 5785, 'B': 4693}}
${Dict2}={'TestB_3': {'l': 310, 'T': 295, 'R': 5785, 'Bo': 4693} ,'TestB_4': {'l': 307, 'T': 290, 'R': 5785, 'B': 4693}}
我想减去并得到这样的结果 ${Dict1}-${Dict2}
${Result} = {'Test_1': {'l': -3 , 'T': -5, 'R': 0, 'Bo': 0} ,'Test_2': {'l': 0, 'T': 0, 'R': 0, 'B': 0}
我知道如何在 Python 中做,但是在 Robot 框架中,我不明白
在 Python 中,
我们做类似的事情
for key1,Key2 in zip(dict1.key, dict2.key):
result[key1]=dict[Key1]-dict[key2]
在python的ROBOT框架中是否有这样的东西
更新更多信息
${x2} Create Dictionary x2=2
${x1} Create Dictionary x1=5
FOR ${key_of_Orginal} ${key_of_Actual} IN ZIP @{x2} @{x1}
Log ${key_of_Orginal}
Log ${key_of_Actual}
END
会报这个错误
Starting test: ManualMargin.Test1.Test8
20200410 14:41:52.061 : INFO : ${x2} = {'x2': '2'}
20200410 14:41:52.063 : INFO : ${x1} = {'x1': '5'}
20200410 14:41:52.064 : FAIL : FOR IN ZIP items must all be list-like, got string.
Ending test: Test8
【问题讨论】:
标签: python python-3.x robotframework