一、列表
1.创建一个列表,关键字 create list, 来自Builtin库,返回一个列表,用@{list}接收
@{list} = | Create List | a | b | c |
2.得到列表的长度, 关键字get length, 来自Builtin库
${length} | get length | @{list} |
3.在列表中添加内容, 关键字append to list,来自Collections库
append to list | ${list} | xxx |
4.将多个列表和在一起,关键字combine lists
${list1} | create list | a | |
${list2} | create list | b | |
${list3} | combine lists | ${list1} | ${list2} |
${list3} 输出内容为 ['a','b']
5.返回列表中给定值出现的次数, 关键字count values in list, 来自Collections库
${count} | count values in list | ${list3} | a |
${count}输出值 1
设${L5}= ['a','b','c','d','e']
6.根据索引来获取某个值, 关键字get from list, 来自Collections库
${x} | get from list | ${L5} | 0 |
${x}的值为a
7.根据给定值获取索引, 关键字get index from list, 来自Collections库
${index} | get index from list | ${L5} | d |
${index}的值为 3
8.根据索引范围获取一段列表,关键字get slice from list, 来自Collections库
${list3} | get slice from list | ${L5} | 2 | 4 |
${list3}值为['c','d']
9.在列表中根据索引插入给定值, 关键字insert into list, 来自Collections库
insert into list | ${L5} | 0 | xxx |
${L5}值为 ['xxx','a','b','c','d','e']
10.根据索引移除给定值, 关键字remove from list,来自Collections库
${x} | remove from list | ${L5} | 0 |
${x}值为 xxx
${L5}值为 ['a','b','c','d','e']
11. 移除给定值, 关键字 remove values from list, 来自Collections库
remove values from list | ${L5} | c | d |
${L5}值为 ['a','b','e']
12.至反列表,关键字reverse list,来自Collections库
reverse list | ${L5} |
${L5}值为 ['e','b','a']
13.修改某个索引值,关键字 set list value,来自Collections库
set list value | ${L5} | 0 | a |
${L5}值为 ['a','b','a']
14.排序列表,关键字 sort list,来自Collections库