Remove the First Character of a Python String

While I was working on a project, I had to clean up some text data coming from a CSV file. The problem was simple: every string in the file started with an unwanted symbol.

At first, I thought there would be a built-in option in Python to remove the first character. But I quickly realized that Python doesn’t have a dedicated function for this.

In this tutorial, I’ll show you five practical methods I use to remove the first character from a Python string. I’ll also share some real-world examples so you can see where each method makes sense.

Method 1 – Use String Slicing

The most common and simple way is to use slicing. Python strings are sequences, so you can access parts of them using index positions.

Here’s how I usually do it:

# Example: Removing the first character using slicing
text = "@PythonGuides is my go-to site for tutorials."
cleaned_text = text[1:]

print("Original:", text)
print("After removing first character:", cleaned_text)

Output:

Original: @PythonGuides is my go-to site for tutorials.
After removing first character: PythonGuides is my go-to site for tutorials.

You can see the output in the screenshot below.

python remove first character from string

In this case, the first character @ was removed. This method is super fast and works in almost all cases.

Method 2 – Use str.lstrip()

Sometimes, I don’t just want to remove the first character but also any specific unwanted symbol at the start. That’s where lstrip() comes in handy.

# Example: Using lstrip to remove the first character
text = "#DataScience is growing fast in the USA."
cleaned_text = text.lstrip("#")

print("Original:", text)
print("After removing first character:", cleaned_text)

Output:

Original: #DataScience is growing fast in the USA.
After removing first character: DataScience is growing fast in the USA.

You can see the output in the screenshot below.

remove first character from string python

Note: lstrip() removes all occurrences of the character from the beginning, not just the very first one. So if your string starts with multiple #, they’ll all be removed.

Method 3 – Use replace() (with count=1)

If you want to remove the first character only once, you can use replace() with a count parameter.

# Example: Using replace with count=1
text = "$500 is the average monthly rent in some US cities."
cleaned_text = text.replace(text[0], "", 1)

print("Original:", text)
print("After removing first character:", cleaned_text)

Output:

Original: $500 is the average monthly rent in some US cities.
After removing first character: 500 is the average monthly rent in some US cities.

You can see the output in the screenshot below.

python string remove first character

This is useful when the first character also appears later in the string, and you don’t want to remove those.

Method 4 – Use Regular Expressions (re.sub)

When I’m cleaning messy datasets, I often rely on regular expressions. With re.sub, you can remove the first character regardless of what it is.

import re

# Example: Using regex to remove the first character
text = "*Breaking News: Python is now the most popular language in the USA!"
cleaned_text = re.sub(r'^.', '', text)

print("Original:", text)
print("After removing first character:", cleaned_text)

Output:

Original: *Breaking News: Python is now the most popular language in the USA!
After removing first character: Breaking News: Python is now the most popular language in the USA!

Here, ^. means “match the first character of the string.” It’s a flexible method if you’re already using regex in your project.

Method 5 – Use a Loop (For Beginners)

Although not the most efficient, sometimes I show beginners how to do it with a for loop.
This makes the logic very clear.

# Example: Removing the first character using a loop
text = "!Hello from New York!"
new_text = ""

for i in range(1, len(text)):
    new_text += text[i]

print("Original:", text)
print("After removing first character:", new_text)

Output:

Original: !Hello from New York!
After removing first character: Hello from New York!

This method is slower than slicing, but it helps beginners understand how string manipulation works.

Real-World Use Cases in the USA

Here are a few examples where I’ve personally used these methods in real-world projects:

  1. Cleaning financial data – Removing $ from salary or rent values.
  2. Processing survey responses – Dropping unwanted symbols like # or * added by respondents.
  3. Working with CSV files – Sometimes data exports include extra characters like ? or @ at the start of each line.
  4. Web scraping – Many scraped strings include unwanted prefixes such as - or +.

These methods make cleaning such data much faster.

Which Method Should You Use?

  • Use slicing if you just want to remove the first character quickly.
  • Use lstrip() if you want to remove specific unwanted characters at the start.
  • Use replace() if the first character also appears later in the string.
  • Use regex if you’re already cleaning text with patterns.
  • Use a loop only for learning purposes.

For most cases, I stick to slicing because it’s short, fast, and easy to read.

When I first started working with Python strings, I often overcomplicated things.
But over the years, I’ve realized that the simplest solution (like slicing) is usually the best.

Hopefully, this guide gave you multiple approaches so you can choose the one that fits your project.
Next time you see an unwanted character at the start of your string, you’ll know exactly how to handle it.

You may also read:

51 Python Programs

51 PYTHON PROGRAMS PDF FREE

Download a FREE PDF (112 Pages) Containing 51 Useful Python Programs.

pyython developer roadmap

Aspiring to be a Python developer?

Download a FREE PDF on how to become a Python developer.

Let’s be friends

Be the first to know about sales and special discounts.