我正在尝试使用 python 的 re.sub 函数来替换一些文本。
>>> import re
>>> text = "<hi type=\"italic\"> the></hi>"
>>> pat_error = re.compile(">(\s*\w*)*>")
>>> pat_error.search(text)
<_sre.SRE_Match object at 0xb7a3fea0>
>>> re.sub(pat_error, ">\1", text)
'<hi type="italic">\x01</hi>'
之后 text 的值应该是
"<hi type="italic"> the</hi>"