Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
https://docs.python.org/3.8/library/stdtypes.html?highlight=lstrip#str.lstrip > Return a copy of the string with leading characters removed. The chars > argument is a string specifying the set of characters to be removed. If > omitted or None, the chars argument defaults to removing whitespace. The > chars argument is not a prefix; rather, all combinations of its values are > stripped: The last sentence talks about the report. In the given examples it strips all the given characters in chars from left until it finds a character that is not found as part of the given chars argument. In [2]: 'mailto:ma...@gmail.com'.lstrip('mailto:') # Stops at 'r' that doesn't need to be stripped Out[2]: 'r...@gmail.com' In [3]: 'mailto:ma...@gmail.com'.lstrip('ailto:') # 'm' is the first character and is not found in chars 'ailto:' Out[3]: 'mailto:ma...@gmail.com' Changing this would break a lot of old code and adding an API for two different behaviors would require a larger discussion. Perhaps did you find any part of docs that you would like to improve to clarify this better? ---------- nosy: +xtreak versions: -Python 3.5, Python 3.6, Python 3.9 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue36410> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com