Elliot
-1
Q:

python remove last 4 characters from string

str =  "string"
str = str[:-1]  # Returns "strin"
16
st =  "abcdefghij"
st = st[:-1]  # Returns string with last character removed
14
your_string = "hello"
your_string = your_string[:-1] # this removes the last character from your string 
2
foo = foo[:-n]
0
str = "abc"
str = str[:-1]
print(str)

>>> ab
0
st =  "abcdefghij"
st = st[:-1]
-1
st="velm"
str = str[:-1] 
-1

New to Communities?

Join the community