Exception message (Python 2.6)

后端 未结 4 1263
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-05 10:02

In Python, if I open a binary file that doesn\'t exist, the program exits with an error and prints:

Traceback (most recent call last):
  File \"C:\\Python_te         


        
4条回答
  •  情话喂你
    2020-12-05 10:25

    Thanks for all.

    That's, what I needed :)

    import traceback
    
    try:
        # boom
    except Exception:
        print traceback.format_exc()
    

提交回复
热议问题