python exception catch exception stack output

python exception catch exception stack output

Learned: https://blog.csdn.net/chris_grass/article/details/77927902

import traceback
def fun(a,b):
    return a/b
try:
    fun(1,0)
except Exception as e:
    traceback.print_exc()

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325203414&siteId=291194637