Use s[1:] to get a new string containing everything after the first element of s. For example, "Python"[1:] evaluates to "ython". The original string is unchanged.
Use a slice to drop the first element
Python sequence indexes start at zero: index 0 is the first element, and index 1 is the second. A slice beginning at index 1 skips the first element and runs to the end; leaving off the stop index means the slice continues through the sequence.
s = "Python"
result = s[1:] # "ython"
The slice returns a string value. Python strings are immutable, so it does not alter the string that s refers to. Assign the result to a name if you need to keep using it.
What happens with empty and one-character strings?
The same slice works for both cases. When the start index is beyond the available sequence, slicing returns an empty string rather than raising an indexing error.
#1 Best Overall
"Python"[1:] # "ython"
"A"[1:] # ""
""[1:] # ""
Why item assignment and deletion do not work
Indexing can retrieve an element, but it cannot remove or replace an element in a string. Expressions such as s[0] = "" and del s[0] attempt to mutate an immutable string and fail. Create the desired value with s[1:] instead.
Choose the operation that matches your intent
- Drop the first element regardless of what it is: use
s[1:]. - Remove a particular prefix only when present: use
s.removeprefix(prefix). It removes the specified prefix conditionally, rather than discarding one element unconditionally. - Remove leading whitespace: use
s.lstrip(). It strips whitespace by default, not one arbitrary first element. If passed a string of characters,lstrip(chars)strips leading characters drawn from that set; it does not remove that exact string as a single prefix.
What “character” means for Unicode strings
Python strings are sequences of Unicode code points, and indexing a non-empty string produces a one-element string. Therefore s[1:] removes one code point from the start. A visible symbol may consist of multiple code points—for example, a letter followed by a combining mark or an emoji sequence—so a slice can split a symbol that appears as one character on screen. If you need to remove one whole user-perceived grapheme, use grapheme-aware segmentation rather than ordinary string slicing.
Rank #2
See the Python documentation on text and slicing and the built-in str type.
Quick Recap
Best Value
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.
Quick wins for a faster PC:
Fix the driver behind crashes, sound loss and screen glitchesFind Drivers →Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →




