我的代码:
html = "<tag> </tag>"
from bs4 import BeautifulSoup
print BeautifulSoup(html).renderContents()
输出:
<tag> </tag>
期望的输出:
<tag> </tag>
BeautifulSoup 似乎用一个表示相同含义的 unicode 字符替换了我的破坏空间 html 转义。但这并不能一直贯穿我的系统,最终成为一个不间断的空间,因此没有做我想做的事。有没有办法告诉 BeautifulSoup 不要那样做?