What is the best way to remove 1st letter from string? [Python] | Sololearn: Learn to code for FREE!

+2

What is the best way to remove 1st letter from string? [Python]

7/25/2021 6:25:17 AM

Bhavik Mahalle

4 Answers

New Answer

+2

Adding more to NotAPythonNinja's answer or for more list slicing tutorials. https://code.sololearn.com/cAQBZ3dHmbKW/?ref=app

+1

myString = "Some words go here." myString = myString[1:] print (myString) #>>ome words go here.

0

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