Python entfernen Sie das erste und letzte Zeichen aus String
string = string[1:-1]
Annoyed Antelope
string = string[1:-1]
greeting = "HHello world!"
new_greeting = greeting[1:]
# In here we select greeting string from character 1 to end (except character 0)
print(new_greeting)
#output: Hello world!
s = ":dfa:sif:e"
print(s[1:])
prints:
dfa:sif:e
String str = "Hello World";
String str2 = str.substring(1,str.length());
>>>mystring = "Description: Mary had a little lamb Description: "
>>>print mystring.replace("Description: ","",1)
"Mary had a little lamb Description: "
r = "hello"
r = r[1:]
print(r) # ello