得到返回的对象(response)后,不去刻意查看,是不知道编码方式的大多数是“utf-8”。

在requests里的快捷的解码方式可以使用如下几种:

1.

response.text

·类型:str

·解码类型:根据http头部对响应的编码作出推测

·修改:response.encoding="utf-8"

2.

response.content.encode()

这里encode默认使用“utf-8”

·类型:bytes

·解码方式:没指定

3.

response.content.encode("gbk')

相关文章:

  • 2021-09-18
  • 2022-01-01
  • 2022-03-04
  • 2022-12-23
  • 2022-12-23
  • 2021-12-12
  • 2021-12-15
  • 2021-11-19
猜你喜欢
  • 2022-12-23
  • 2022-01-29
  • 2021-10-08
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案