Python3中,str类型的数据,是big5编码的。str没有decode方法。
我知道 str 和 bytes的关系是
str --encode--> bytes --decode--> str
如果是bytes的话,直接bytes.decode('big5')输出就可以正常显示了。
但原始内容就是str,无法decode。直接输出或encode后再decode都乱码。
求教。
Python3中,str类型的数据,是big5编码的。str没有decode方法。
我知道 str 和 bytes的关系是
str --encode--> bytes --decode--> str
如果是bytes的话,直接bytes.decode('big5')输出就可以正常显示了。
但原始内容就是str,无法decode。直接输出或encode后再decode都乱码。
求教。
1 回答3.2k 阅读✓ 已解决
1 回答578 阅读
通过
requests.encoding查看源编码,得到为 ISO-8859-1 编码。输出正常。