Dictionary 如何使用robot框架从阵列中读取密钥?

Dictionary 如何使用robot框架从阵列中读取密钥?,dictionary,robotframework,Dictionary,Robotframework,我需要从数组中读取两个名为value的键。我能看懂一把钥匙。需要帮助读取两个名为“value”的键 我使用了机器人框架 RobotFramework.robot: ${readvalues}= [{u'count': 1, u'id': u'vegetable', u'value': u'veg'}, {u'count': 1, u'id': u'Non_vegetarian', u'value': u'Non_veg'}] ${read_prv_value}= Set Vari

我需要从数组中读取两个名为value的键。我能看懂一把钥匙。需要帮助读取两个名为“value”的键

我使用了机器人框架

RobotFramework.robot:

 ${readvalues}=  [{u'count': 1, u'id': u'vegetable', u'value': u'veg'}, {u'count': 1, u'id': u'Non_vegetarian', u'value': u'Non_veg'}]

 ${read_prv_value}=     Set Variable     ${readvalue['value']}
 log to console   ${read_prv_value}   #prints Non-veg alone I expected Veg and Non Veg
  ${value_cnt}=    Get Length    ${readvalues}
  : FOR    ${item}    IN RANGE   0    ${value_cnt}
         \    ${readvalue}=    Set Variable     ${var[${item}]['value']}

我期望素食和非素食,但实际的o/p是非素食的,这不是两个字典的列表吗?然后,您必须循环列表或使用提供列表索引的单独词典

Read with loop
${d1}=    Create Dictionary    count=1    id=vegetable    value=veg
${d2}=    Create Dictionary    count=1    id=Non_vegetarian    value=Non_veg
${readvalues}=  Create List    ${d1}    ${d2}
: FOR    ${item}    IN    @{readvalues}
\    ${value}=    Set Variable     ${item}[value]
\    Log To Console    ${value}

Read without loop
    ${d1}=    Create Dictionary    count=1    id=vegetable    value=veg
    ${d2}=    Create Dictionary    count=1    id=Non_vegetarian    value=Non_veg
    ${readvalues}=  Create List    ${d1}    ${d2}
    ${value1}=    Set Variable     ${readvalues}[0][value]
    Log To Console    ${value1}
    ${value2}=    Set Variable     ${readvalues}[1][value]
    Log To Console    ${value2}
两个关键字都是日志:

veg
Non_veg

你能帮助我使用我尝试过的for循环代码吗?