您不需要为此使用正则表达式。我会做
str = "What $noun$ is $verb$?"print str.replace("$noun$", "the heck")
仅在需要时使用正则表达式。通常比较慢。
上一篇 Python鼻子导入错误
下一篇 Python编译/解释过程
版权所有 (c)2021-2022 MSHXW.COM
ICP备案号:晋ICP备2021003244-6号