【Python】pythonのtry~except~else Python Posted by: 2021年2月9日 no comments yet <スポンサーリンク> コード def func(a, b): try: print(a / b) except ZeroDivisionError as e: print('例外Error:', e) else: print('finish') # 正常 func(1, 2) # 0で割れないので例外エラー func(1, 0) 実行結果 0.5 finish 例外Error: division by zero <スポンサーリンク> older newer コメントを残す コメントをキャンセルAllowed tags: you may use these HTML tags and attributes: <a href="">, <strong>, <em>, <h1>, <h2>, <h3>Please note: all comments go through moderation. Name (required) Email (required) Website キャプチャコード * Δemail confirm* post date* 日本語が含まれない投稿は無視されますのでご注意ください。(スパム対策)