且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Python - 修改反向引用.可以做到吗?

更新时间:2022-11-26 14:29:58

来自 文档:

如果 repl 是一个函数,它会在 pattern 的每个非重叠出现时被调用.该函数采用单个匹配对象参数,并返回替换字符串.例如:

If repl is a function, it is called for every non-overlapping occurrence of pattern. The function takes a single match object argument, and returns the replacement string. For example:

并查看链接文档中包含的示例.

And see the example contained in the linked docs.