remove first and last char from string python code example Example: python remove last character from string str = "abc" str = str[:-1] print(str) >>> ab