1

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,343
  • 23
  • 31

1 Answers1

4

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
  • 13,811
  • 2
  • 31
  • 45