Example: '1 1 1 1'.replace('1', lambda char, index: str(index)+char) # '01 11
21 31'
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/7WBQW3YWNO5MODRQJJXAC2AW3QFGGCXB/
Code of Conduct: http://python.org/psf/codeofconduct/
- [Python-ideas] Use lambda in str.replace/re.sub artem6191
