【发布时间】:2019-10-06 08:36:23
【问题描述】:
Text = "<a> text </a> <c> code </c>"
我想删除python中的<c> code </c>语句
output = "<a> text </a>"
【问题讨论】:
-
使用类似
re.sub(r'<c>.*?</c>', '', Text)的东西。 -
也许相关(并且绝对有趣):stackoverflow.com/questions/1732348/…您确定正则表达式是解决您问题的正确工具吗?
-
谢谢,工作正常
标签: python regex string regex-group regex-greedy