📜  使用 beautifulsoup 获取 br 标记后的文本 - 无论代码示例

📅  最后修改于: 2022-03-11 15:00:27.287000             🧑  作者: Mango

代码示例1
import re
regex = re.compile(r"
", re.IGNORECASE) # the filter, it finds
tags that may or may not have slashes html = 'blah blah b
lah
bl
' newtext = re.sub(regex, '\n', html) # replaces matches with the newline print(newtext) # Returns 'blah blah b\nlah \n bl\n' !