在Robot Framework中,列表变量和包含列表的标量变量之间有什么区别? [英] In Robot Framework, what is the difference between a List Variable and a Scalar Variable containing a list?

查看:753
本文介绍了在Robot Framework中,列表变量和包含列表的标量变量之间有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Robot Framework中,我们可以将列表分配给标量变量或列表变量,如下所示:

In Robot Framework, we can assign a list to a Scalar Variable or to a List Variable, as shown below:

| @{list} =   | Create List | a | b | c |
| ${scalar} = | Create List | a | b | c |

列表变量和包含列表的标量变量之间有什么区别?

What is the difference between a List Variable and a Scalar Variable containing a list?

推荐答案

如果您的问题中显示了作业,则没有区别.如果您将每个日志记录下来,您将获得完全相同的输出.

In case of the assignment shown in your question, there is no difference. If you log each of those you'll get the exact same output.

注意:此功能已在2.8版中引入(请参见

Note: this functionality was introduced in version 2.8 (see Using scalar variables as lists in Robot Framework User's Guide).

使用这些值时会有所不同.当您使用@符号引用列表时,列表中的每个元素都将成为一个单元格.在下面的示例中,以下三行给出相同的结果:

The difference comes when you use the values. When you use the @ symbol to reference a list, each of the elements in the list becomes a cell. In the following example, the following three lines give identical results:

| | A keyword that expects three arguments | a | b | c
| | A keyword that expects three arguments | @{list}
| | A keyword that expects three arguments | @{scalar}

这篇关于在Robot Framework中,列表变量和包含列表的标量变量之间有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆