2

lstrip removed additional character, please help me understand it why. Is it removing all the input characters from the beginning?

'http://twitter.com/c_renwick'.lstrip('http://twitter.com/')
>>>'_renwick'
Itachi
  • 2,817
  • 27
  • 35

1 Answers1

5

lstrip takes a list of characters to remove from the string. As c is in the list you provided, it gets removed

To achieve what you actually want, use replace:

'http://twitter.com/c_renwick'.replace('http://twitter.com/','')
FlyingTeller
  • 17,638
  • 3
  • 38
  • 53