New submission from Chris Rogers <[email protected]>:
Consider this string: 'mailto:mailto:mailto:[email protected]' If you try to remove the mailtos with lstrip('mailto:'), you'll be left with this: '[email protected]' That's because the three strip functions look at each character separately rather than as a whole string. Currently, as a workaround, you have to either use regex or a loop. This can take several lines of code. It would be great if the strip functions had a second parameter that lets you keep the first parameter intact. You could then use this code to get the desired result: 'mailto:mailto:mailto:[email protected]'.lstrip('mailto:', true) >>[email protected] ---------- messages: 361791 nosy: Chris Rogers priority: normal severity: normal status: open title: Add a parameter to strip, lstrip, and rstrip that treats the first parameter as a full string type: enhancement _______________________________________ Python tracker <[email protected]> <https://bugs.python.org/issue39607> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
