Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/276.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Robot框架-将2个字符串与版本信息(x.x.x.x)进行比较_Python_Robotframework - Fatal编程技术网

Python Robot框架-将2个字符串与版本信息(x.x.x.x)进行比较

Python Robot框架-将2个字符串与版本信息(x.x.x.x)进行比较,python,robotframework,Python,Robotframework,我正在为一个项目制作测试场景,面临一个问题,如果您有时间,请帮助我 我现在有两个字符串: ${cr_ver}=4.5.5 ${tobe_upgr_ver}=7.0.0 现在我想比较它们,使之类似:如果${cr\u ver}

我正在为一个项目制作测试场景,面临一个问题,如果您有时间,请帮助我

我现在有两个字符串:

${cr_ver}=4.5.5

${tobe_upgr_ver}=7.0.0

现在我想比较它们,使之类似:如果${cr\u ver}<${tobe\u upgr\u ver},那么测试停止

请给予支持。:)


非常感谢。

您可以从python比较字符串的方式中获益:

${cr_ver}    Set Variable    4.5.5
${tobe_upgr_ver}    Set Variable    7.0.0
Pass Execution If    '${cr_ver}' < '${tobe_upgr_ver}'    tobe_upgr_ver is greater than cr_ver, pass the test
Log    cr_ver is greater than tobe_upgr_ver so let's continue the test
${cr\u ver}设置变量4.5.5
${tobe_upgr_ver}集变量7.0.0
通过执行如果“${cr\u ver}”<“${tobe\u upgr\u ver}”tobe\u upgr\u ver大于cr\u ver,则通过测试
Log cr\u ver大于tobe\u upgr\u ver,所以让我们继续测试

在以下情况下它将失败:“9.1”