zoukankan      html  css  js  c++  java
  • python 中的 try/except/else/finally语句

    1.python中try/except/else/finally正常的语句是这样的:

      try:

        normal excute block

      except A:

        Except A handle

      except B:

        Except B handle

      except:

        other exception handle

      else:

        if no exception,get here

      finally:

        print(hello world)

      说明:

        正常执行的程序在try下面执行normal excute block执行块中执行,在执行中如果发生了异常,则中断当前normal execute block 调到异常处理中开始执行,如果没有异常则会执行else中的语句(前提是有else语句),finally语句是最后一步总会执行的语句。

  • 相关阅读:
    NYOJ458
    NYOJ67
    NYOJ105
    NYOJ1071
    NYOJ463
    C语言练字用小软件 — Practise_Calligraphy_1.0(ANSI)
    NYOJ276
    NYOJ455
    NYOJ74
    Jzoj4458 密钥破解——Pollard-rho
  • 原文地址:https://www.cnblogs.com/huclouy/p/6115829.html
Copyright © 2011-2022 走看看