侧边栏壁纸
  • 累计撰写 197 篇文章
  • 累计收到 496 条评论

AttributeError: 'str' object has no attribute 'decode'

2019-10-28 / 0 评论 / 118 阅读

python3下列代码会报上边的错

print("Response:", resp.text.decode('unicode_escape'))
解决办法:
print("Response:", resp.text.encode('utf-8').decode('unicode_escape'))
中间加上.encode('utf-8')即可

评论一下?

OωO
取消