【发布时间】:2018-10-13 01:24:03
【问题描述】:
我将一些输出拆分为一个列表,然后我试图清理该列表,因为列表中有一些我不需要的值。我想删除任何不是节点或日期的列表项;但是,Remove Values From List 关键字会返回一个空列表。任何建议将不胜感激。
Create And Clean Times List
@{times} Split String ${output} separator=${\n}
Log List ${times}
${value}= Set Variable @{times}[0]
@{times2}= Remove Values From List ${value}
Log List ${times2}
>
KEYWORD Collections . Log List ${times}
Start / End / Elapsed: 20181012 12:16:32.635 / 20181012 12:16:32.636 /
00:00:00.001
12:16:32.636 INFO List length is 28 and it contains following items:
0: META: ran handlers
1: node1 | SUCCESS | rc=0 >>
2: Fri Oct 12 16:16:29 GMT 2018
3: node2 | SUCCESS | rc=0 >>
4: Fri Oct 12 16:16:29 GMT 2018
5: node3 | SUCCESS | rc=0 >>
6: Fri Oct 12 16:16:29 GMT 2018
7: node4 | SUCCESS | rc=0 >>
8: Fri Oct 12 16:16:29 GMT 2018
9: node5 | SUCCESS | rc=0 >>
10: Fri Oct 12 16:16:29 GMT 2018
11: node6 | SUCCESS | rc=0 >>
12: Fri Oct 12 16:16:30 GMT 2018
13: node7 | SUCCESS | rc=0 >>
14: Fri Oct 12 16:16:31 GMT 2018
15: node8 | SUCCESS | rc=0 >>
16: Fri Oct 12 16:16:31 GMT 2018
17: node9 | SUCCESS | rc=0 >>
18: Fri Oct 12 16:16:31 GMT 2018
19: node10 | SUCCESS | rc=0 >>
20: Fri Oct 12 16:16:31 GMT 2018
21: node11 | SUCCESS | rc=0 >>
22: Fri Oct 12 16:16:31 GMT 2018
23: node12 | SUCCESS | rc=0 >>
24: Fri Oct 12 16:16:32 GMT 2018
25: META: ran handlers
26: META: ran handlers
27: [sysadmin@basebox ~]$
00:00:00.001KEYWORD ${value} = BuiltIn . Set Variable @{times}[0]
Start / End / Elapsed: 20181012 12:16:32.637 / 20181012 12:16:32.638 / 00:00:00.001
12:16:32.638 INFO ${value} = META: ran handlers
00:00:00.001KEYWORD @{times2} = Collections . Remove Values From List value='${value}'
Documentation:
Removes all occurrences of given values from list.
Start / End / Elapsed: 20181012 12:16:32.639 / 20181012 12:16:32.640 / 00:00:00.001
12:16:32.640 INFO @{times2} = [ ]
Start / End / Elapsed: 20181012 12:16:32.640 / 20181012 12:16:32.641 / 00:00:00.001
00:00:00.001KEYWORD Collections . Log List ${times2}
Documentation:
Logs the length and contents of the list using given level.
Start / End / Elapsed: 20181012 12:16:32.642 / 20181012 12:16:32.643 / 00:00:00.001
12:16:32.643 INFO List is empty.
【问题讨论】:
标签: robotframework