This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: lstrip not working when string has =e in it
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.8, Python 3.7, Python 3.6, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: Narendra L, christian.heimes, serhiy.storchaka
Priority: normal Keywords:

Created on 2018-02-05 11:07 by Narendra L, last changed 2022-04-11 14:58 by admin. This issue is now closed.

Messages (4)
msg311659 - (view) Author: Narendra L (Narendra L) Date: 2018-02-05 11:07
Lstrip not working as expected when the string has "=e" in it.

Python 2.7.11 (default, Jan 22 2016, 08:28:37)

>>> test = "Cookie:  test-Debug=edttrace=expires=1517828996"
>>> test.lstrip('Cookie:  test-Debug=')
'dttrace=expires=1517828996'
msg311660 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2018-02-05 11:13
It works as documented. Removes characters specified by the argument from the string. In your example the argument contains "e", but doesn't contain "d". Therefore starting characters up to "d" have been removed.
msg311662 - (view) Author: Narendra L (Narendra L) Date: 2018-02-05 11:19
If you see output dttrace.... e is missing 

see working example
>>> test = "Cookie:  test-Debug=edttrace=expires=1517828996"
>>> test.lstrip('Cookie:  test-Debug=')
'dttrace=expires=1517828996'
# e missing here


>>> test = "Cookie:  test-Debug=adttrace=expires=1517828996"
>>> test.lstrip('Cookie:  test-Debug=')
'adttrace=expires=1517828996'
# Works correct here
msg311663 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2018-02-05 11:24
Please read the documentation again. lstrip doesn't work like you assume:

>>> "cbaabcdef".lstrip("abc")
'def'
History
Date User Action Args
2022-04-11 14:58:57adminsetgithub: 76953
2018-02-05 11:24:06christian.heimessetnosy: + christian.heimes
messages: + msg311663
2018-02-05 11:19:09Narendra Lsetmessages: + msg311662
2018-02-05 11:13:48serhiy.storchakasetstatus: open -> closed

nosy: + serhiy.storchaka
messages: + msg311660

resolution: not a bug
stage: resolved
2018-02-05 11:07:49Narendra Lcreate