📅  最后修改于: 2022-03-11 15:00:27.287000             🧑  作者: Mango
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' !