+ 3
What is the best way to remove 1st letter from string? [Python]
4 ответов
+ 3
Adding more to NotAPythonNinja's answer or for more list slicing tutorials.
https://code.sololearn.com/cAQBZ3dHmbKW/?ref=app
+ 2
myString = "Some words go here."
myString = myString[1:]
print (myString)
#>>ome words go here.
+ 1
It is another way to remove first letter from string
string = "string"
s = list(string)
string = "".join(s[1:])
print(string) # it outputs "tring"
DHANANJAY PATEL
0
Strong are immutable i.e
Instead, you assign a new string from the sliced string like this :
name = "Sulaiman"
s_name = name[1:]
print(name). #this print Sulaimon
print(s_name). #this print ulaiman