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  

相关文章:

  • 2022-12-23
  • 2021-07-31
  • 2021-09-20
  • 2021-09-17
  • 2021-09-01
  • 2022-12-23
  • 2021-10-12
猜你喜欢
  • 2021-04-16
  • 2021-11-27
  • 2021-07-27
  • 2022-03-10
相关资源
相似解决方案