Ben Wise Ben Wise - 9 months ago 27
Python Question

Python string slice indices - slice to end of string

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.

word = "Help"
word[1:-1] # But I want to grab up to end of string!
word[1:len(word)] # Works but is there anything better?


You can instead try using: