【Python】使用goto語句


python沒有原生goto語句,需要安裝第三方庫。

安裝: pip3 install goto-statement

示例:

@with_goto
def get_response(i):
    label .begin

    print(i)
    site = "XXX" 
 
    r = urllib.request.Request(site, headers=hdr)
    try:
        response = urllib.request.urlopen(r,timeout=10)
    except:
        goto .begin
    return response  


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM