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.

Author hcoin
Recipients hcoin
Date 2019-07-18.13:59:00
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1563458340.3.0.354346385459.issue37620@roundup.psfhosted.org>
In-reply-to
Content
When first I read the str.split documentation I parsed it to mean
'ab\t cd ef'.split(sep=' \t') --> ['ab','cd','ef']
Especially as the given example in the docs with the <> would have led to the given result read the way I read it.

I suggest adding a parameter 'any=False' which by default gives the current behavior.  But when True treats each character in the sep string as a delimiter and eliminates any combination of them from the resulting list.

The use cases are many, for example parsing the /etc/hosts file where we see an address, some white space that could be any combination of \t and ' ' followed by more text. 

One could imagine 'abc  \tdef, hgi,jlk'.split(', \t',any=True) -> ['abc','def','hgi','jlk'] being used quite often.
History
Date User Action Args
2019-07-18 13:59:00hcoinsetrecipients: + hcoin
2019-07-18 13:59:00hcoinsetmessageid: <1563458340.3.0.354346385459.issue37620@roundup.psfhosted.org>
2019-07-18 13:59:00hcoinlinkissue37620 messages
2019-07-18 13:59:00hcoincreate