Handle Arbitrary Exception, Print Default Exception Message

前端 未结 5 639
我寻月下人不归
我寻月下人不归 2021-01-01 16:00

I have a program, a part of which executes a loop. During the execution of this loop, there are exceptions. Obviously, I would like my program to run without errors, but for

5条回答
  •  佛祖请我去吃肉
    2021-01-01 16:42

    try:
        #stuff
    except Exception as e:
        print e
    

    The traceback module provides various functions for extracting more information from the exception object (e, above).

    Source Errors and Exceptions

提交回复
热议问题