The exception is right there. It's an index error, that is it's trying to do something going beyond the range of what this thing could deal with.
但他事实上抛出一个异常,异常就在这里,这是一个下标错误,它是试图去取超出范围的元素造成的。
If I do this, try and get the 10th element of a list that's only eight long. I get what looks like an error, but it's actually throwing an exception.
如果我来这么做,试着去取长度为8的列表的第十个元素,我貌似能得到一个错误。
But if I say turn this into a float, ah it throws a value error exception.
它就会抛出一个值错误异常了,它会告诉我输入了一种错误的值。
That says it's in here. It's in this tri-block. It raised an exception, but it wasn't and I O error.
这在这里它是一个try程序块,它报出异常,但他不是io错误。
An exception is called a name error exception.
一个被称作命名错误的异常。
Notice though what I've done. Open, a particular kind of exception called I O error.
不过还是看看我们做的,这里我们并没有把异常报做io错误。
应用推荐