保存详细异常信息 import traceback def test(): try: ... ... except Exception as e: traceback.print_exc(file=open("err.log", 'a+'))