Exception as eを使う
try: print(1 / 0) except Exception as e: print(e)
tracebackモジュールを使う
import traceback try: print(1 / 0) except: traceback.print_exc()
try: print(1 / 0) except Exception as e: print(e)
import traceback try: print(1 / 0) except: traceback.print_exc()
コメント