Answers for "remove 2 last char on string python"

78

python remove last character from string

str =  "string"
str = str[:-1]  # Returns "strin"
Posted by: Guest on July-25-2020
1

Python remove last character from string

# Python program to remove last character from a string using slice notation

text= 'Hello World!'
print(text[:-1])
Posted by: Guest on December-08-2021

Code answers related to "remove 2 last char on string python"

Python Answers by Framework

Browse Popular Code Answers by Language