使用追溯存储和打印异常吗?

Odr*_*ded 4 python python-3.x

在python3程序中,我有一个特定的try...except块,我将在某种方法中list发生的异常存储到已发生的异常中。简化版本如下所示:

def the_method(iterable):
   errors = []
   for i in iterable:
       try:
           something(i)
        except Exception as e:
            errors.append(e)
   return errors
Run Code Online (Sandbox Code Playgroud)

方法返回,我想在控制台中打印错误。如何使用追溯和通常未捕获的异常格式打印异常