>>> s[0]
'n'
>>> s[18]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>> s[17]
'u'
>>> s[0:17]
'ni ming de hao yo'
>>> s[0:18]
'ni ming de hao you'
>>> s[18]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
IndexError: string index out of range
>>>
s[18]越界了 但切片索引的时候为什么s[0:18]可以输出?