Python学習【異常処理】


異常
        ,               。

       ,               。

    ,         。

            ,        。

例外キャプチャ
try-except  (else finally    )

       try    , try        except      exception  

                       ,       except    

    except          
try:
               
except exception1 , exception2: #   exception1 exception
        try   exception1 2      
except [Exception as error]:#           error      ,       
        try            
else:
        try      ,             
finally:
                ,         

異常を投げ出す
raise             。
raise exception1 #  exception1  

断言する
assert               ,        
            ,       ,      
assert expression [, arguments]