DEV Community

Murtaja Ziad
Murtaja Ziad

Posted on • Originally published at blog.murtajaziad.xyz on

How to remove the first character of a string in Python?

You can remove the first character of a string using Python easily by removing the first index of the string.

string = "abcdef"
print(string[1:]) # bcdef
Enter fullscreen mode Exit fullscreen mode

[1:] means get the string starting from index 1 to the end. Also, you can use it with any index using this syntax: string[start:stop].

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay