strip first and last character python code example
Example 1: python remove last character from string
str = "string"
str = str[:-1] # Returns "strin"
Example 2: python remove first and last character from string
string = string[1:-1]
Example 3: python remove last character from string
st = "abcdefghij"
st = st[:-1]