标签: python-2.7 python-3.x
>>> word="python" >>> word[42] Traceback (most recent call last): File "<stdin>", line 1, in <module> IndexError: string index out of range >>> word[4:42] 'on' >>> word[42:] ''
我的问题是为什么切片操作符不能给IndexError?
IndexError