Python2 RF(3.0.4)与Python3 RF(3.1.2)区别

Note:3.1.2下面没有pybot了,替换成robot.写Case的文件,类型采用robot类型.Resource文件依旧可以使用txt

1,python3 下面不要使用<>.使用!=替换

Exit For Loop If    "${data.status_code}"!="200

2,request python3返回的content是byte类型,python2不是。所以需要用Decode Bytes To String这个方法转一下content

${content}    Decode Bytes To String    ${responseOfSameIds.content}    UTF-8
Run Keyword And Continue On Failure    should contain    ${content}    Duplicate key


3,python3没有split 可以使用Split String替代

${result}    Split String    ${pVersion}    .    1


4,python3没有find,用${findResult} Run Keyword And Return Status Should Contain ${executeResult} is running类似替换

${findResult}    Run Keyword And Return Status    Should Contain    ${executeResult}    sync-agent
Run Keyword If    ${findResult} == ${False}   Restart Probe


5,No keyword with name 'Strip' found.用Strip String替代

${tmpLine}    Strip String    ${eachLine[0]}


6,No keyword with name 'Replace' found.用Replace String替代

${rDate}    Replace String    ${tmpDate[0]}    _    ${SPACE}


7,For循环,不用添加":",结束用END

FOR    ${rtvfile}    IN    @{pRtvPrefixWithPath}
    ${prefix}    split string    ${rtvfile}    /
    append to list    ${rtvPrefixWithoutPath}    ${prefix[-1]}
END



posted on 2020-03-25 17:22  肉松蛋卷  阅读(398)  评论(0编辑  收藏  举报