【发布时间】:2011-03-23 13:55:59
【问题描述】:
我有一个 html 文件,我想用空格替换空段落。
mystring = "This <p></p><p>is a test</p><p></p><p></p>"
result = mystring.sub("<p></p>" , " ")
这不起作用。
【问题讨论】:
-
... 请记住,正则表达式肯定会在某人的格式错误的 html 上失败,例如 '
This
is a
测试
'