在python2的使用中,总会遇到各种各样的编码问题,这也是使用Python2最头疼的一件事情,幸好python3解决了编码的问题。

下面我在爬虫时遇到的类似é‡ç»„äººè¡¨çš®ç”Ÿé•¿å› å­å‡èƒ¶(易孚格式的编码。

解决:

  response = requests.get(url)

  response.encoding = response.apparent_encoding  # 将乱码进行编码

  html = etree.HTML(response.text)

相关文章:

  • 2022-12-23
  • 2022-01-16
  • 2022-12-23
  • 2021-12-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-02-19
  • 2022-12-23
  • 2022-12-23
  • 2022-02-19
  • 2022-02-22
  • 2022-12-23
  • 2021-12-11
相关资源
相似解决方案