We have this in re.sub(). Not sure we need a second way to do it. On Sun, Jul 19, 2020 at 12:57 PM artem6191 <artem129...@gmail.com> wrote:
> Example: '1 1 1 1'.replace('1', lambda char, index: str(index)+char) # '01 > 11 21 31' > _______________________________________________ > Python-ideas mailing list -- python-ideas@python.org > To unsubscribe send an email to python-ideas-le...@python.org > https://mail.python.org/mailman3/lists/python-ideas.python.org/ > Message archived at > https://mail.python.org/archives/list/python-ideas@python.org/message/7WBQW3YWNO5MODRQJJXAC2AW3QFGGCXB/ > Code of Conduct: http://python.org/psf/codeofconduct/ > -- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/OUUIT4GRWQ7TWC6L7HGY2BU7IURIOUV7/ Code of Conduct: http://python.org/psf/codeofconduct/