在Python 3中,可以在except捕捉到例外後,將例外物件指定給變數。例如:. >>> try: ... raise IndexError('11') ... except IndexError as e: ... print(type(e) ...
確定! 回上一頁