我在python中创建了一个字符串:'HelpA'并将其标记为单词.
>>>word='HelpA'
>>>word
'HelpA' #expected string
>>>word[0:4]
'Help' #expected string
Run Code Online (Sandbox Code Playgroud)
在使用负索引调用单词时,我得到的是完整字符串而不是预期的部分字符串.
>>>word[-97:]
'HelpA' #not the expected string
Run Code Online (Sandbox Code Playgroud)
它给出了整个字符串而不是预期的字符串:'pA'为什么会发生这种情况?