【问题标题】:Beautiful Soup conversion of Unicode characters to HTML entitiesBeautiful Soup 将 Unicode 字符转换为 HTML 实体
【发布时间】:2023-03-30 12:21:01
【问题描述】:

将文档加载到beautifulsoup后出现此错误
该文档包含像 “ 这样的实体,它被转换为 ΓÇ£
我想输出html实体“

【问题讨论】:

  • 你想要html中的特殊字符或特殊字符的代码
  • 代码。就像原来的html里写的一样
  • 为你唤醒了下面的代码
  • 是的。这似乎行得通。谢谢。

标签: python python-2.7 unicode encoding beautifulsoup


【解决方案1】:

使用这个refernce link

 from bs4 import BeautifulSoup
    soup = BeautifulSoup(html_doc)
    print(soup.prettify(formatter="html"))

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-04-17
    • 2015-03-07
    • 2018-08-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多