有时候为了调试方便需要格式化所有的异常信息,方式如下 except Exception as e: for artt in dir(e): rmsg = rmsg + artt + \':\' + str(getattr(e, artt)) + \'\r\n\' 相关文章: