[issue28029] Replace and empty strings

Serhiy Storchaka report at bugs.python.org
Thu Sep 8 17:26:07 EDT 2016


Serhiy Storchaka added the comment:

Agreed with Stéphane. Since count() returns 1, resulting string should contain 1 replacement.

Using regular expressions:

>>> re.sub('', 'x', '')
'x'
>>> re.sub('', 'x', '', 1)
'x'

----------
nosy: +serhiy.storchaka

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue28029>
_______________________________________


More information about the Python-bugs-list mailing list