【发布时间】:2012-11-08 14:59:05
【问题描述】:
我正在从文件中读取一个字符串:
a = '<script>closedSign: \'<img src="/static/images/drop-down.png" style="margin-top: -3px;" />\'</script>'
现在,当我跑步时
BeautifulSoup(a)
<script>closedSign: '<img src="/static/images/drop-down.png" style="margin-top: -3px;" />'</script>
因此,&lt;img 被 HTML 转义为 &lt;img
我怎样才能避免这种情况?
【问题讨论】:
-
避免什么?你想达到什么目标?
-
刚刚编辑了问题以更好地解释它。另外,刚刚注意到这个问题只发生在 BeautifulSoup3.2.1 而不是 3.2.0
-
听起来你遇到了这个问题:bugs.launchpad.net/beautifulsoup/+bug/949074
标签: python escaping beautifulsoup html-escape-characters