Use the slice method to remove the first character in Python. Here’s how the code would look like:
text = 'lipsum' print(text[1:])
Removing the first x characters from a string in Python
Use string slicing syntax string[n:] with n as the number of characters to remove the first n characters from a string.
Example removing the first 3 char from the given string.
text = 'lipsum' print(text[3:])
Do comment if you have any doubts and suggestions on this Python char code.
Note: IDE: PyCharm 2021.1.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.