去除内容中的多余br标签

def br2_br1(content):
    content = re.sub('<br>(\s+)<br>', '', content)
    content = re.sub(r"(<br>)\1+", r"\1", content)
    content = re.sub("<br>", '<br><br>', content)
    return content

 

posted @ 2023-11-13 09:14  布都御魂  阅读(36)  评论(0编辑  收藏  举报