0

So I have a super long string composed of integers and I am trying to extract and remove the first three numbers in the string, and I have been using the lstrip method (the idea is kinda like pop) but sometimes it would remove more than three.

x="49008410..."
x.lstrip(x[0:3])
"8410..."

I was hoping it would just remove 490 and return 08410 but it's being stubborn -_- .

Also I am running Python 2.7 on Windows... And don't ask why the integers are strings. If that bothers you, just replace them with letters. Same thing! LOL

Bhargav Rao
  • 50,140
  • 28
  • 121
  • 140
Chris Nguyen
  • 160
  • 1
  • 4
  • 14

1 Answers1

4

Instead of remove the first 3 numbers, get all numbers behind the third position. You can do it using : operator.

x="49008410..."
x[3:]
>> "8410..."
levi
  • 22,001
  • 7
  • 73
  • 74