如何在python中将字节转换为字符串

2024-10-03 04:31:20 发布

您现在位置:Python中文网/ 问答频道 /正文

我从这样的网页上获取内容

url = 'http://s0.icaipiao123.com/api/v2/rank/landing?lottery_key=shuangseqiu'
scode = requests.get(url).content

print(scode.decode('utf8'))

print(type(scode))

print(scode.decode())

错误是 “utf-8”编解码器无法解码位置5中的字节0xeb:无效的连续字节

enter image description here 如何将字节转换成字符串,谢谢


Tags: comapihttpurl网页内容字节v2