是否有可能获得导致IndexError异常的索引?
示例代码:
arr = [0, 2, 3, 4, 5, 6, 6]
try:
print arr[10] # This will cause IndexError
except IndexError as e:
print e.args # Can I get which index (in this case 10) caused the exception?
Run Code Online (Sandbox Code Playgroud)