New submission from Natalie Amery <phq...@fyvzl.net>:

If I want to remove the default set of 'whitespace' characters plus something 
else from a string there's currently no way to cleanly specify that.  In 
addition there's no way to programatically acquire what characters are 
considered whitespace so you can't call split with an argument constructed of 
existing whitespace characters with the new things you need.

As an example you could have an additionally= parameter such that:

"   ( 123 )   ".strip() gives "( 123 )" and
"   ( 123 )   ".strip(additionally="()") gives "123"

I've not given that any thought so it's probably not the best way of solving 
the problem.

----------
messages: 360459
nosy: senji
priority: normal
severity: normal
status: open
title: str.strip() should have a means of adding to the default behaviour
type: enhancement
versions: Python 2.7, Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue39418>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to