zoukankan      html  css  js  c++  java
  • 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



  • 相关阅读:
    python 的class和def 定义执行语句相关
    python _和__ 下划线命名规则
    python2和python3编码问题【encode和decode】
    cpython源码阅读
    eCPRI
    python内存管理/垃圾回收
    Class() vs self.__class__()
    JAVA学习日报 11/24
    JAVA学习日报 11/23
    JAVA学习日报 11/22
  • 原文地址:https://www.cnblogs.com/ting152/p/12567494.html
Copyright © 2011-2022 走看看