Python string slice indices - slice to end of string
You can instead try using:
word[1:]
Or even:
>>> word = "Help"
>>> word[-3:]
'elp'
I found myself needing to specify the end index as an input variable in a function. In that case, you can make end=None
. For example:
def slice(val,start=1,stop=None)
return val[start:stop]
word = "Help"
slice(word) # output: 'elp'