#reset 接口# {"msg": "除数不能为0", code: 255, data: [{"a": 1}, {"b": 2}]}# Exception 所有异常的父类import jsondef test(): result = dict() try: print(2/0) except Exception as e: result["mes"] = "除数不能为零" result["code"] = 404 result["data"] = [{"a":1},{"b":2}] raise e finally: # print("无论如何都会执行") return json.dumps(result) # 将Json数据转换为字符串print(type(test()))