Python string slice indices - slice to end of string

后端 未结 7 1746
粉色の甜心
粉色の甜心 2020-12-28 15:39

With string indices, is there a way to slice to end of string without using len()? Negative indices start from the end, but [-1] omits the final character.

w         


        
相关标签:
7条回答
  • 2020-12-28 16:33

    Are you looking for this?

    >>> word = "Help"
    >>> word[1:]
    'elp'
    
    0 讨论(0)
提交回复
热议问题