例外
記事
IT・テクノロジー
例外処理
try:
...
except Exception as e:
print(err)
except
except Exception as e:
エラーメッセージを表示
except Exception as e:
print(e)
エラーを投げる
raise Exception("エラーメッセージ")
値エラー
raise ValueError("エラーメッセージ")
キャッチした例外を投げる
except Exception:
raise
投げる例外を指定しなくてOK