原文:UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc0 in position 344: invalid start byte报错解决方案

一 问题描述 使用python爬虫爬取某网页的内容时,代码中因为这行代码报错:cont rep.read .decode 二 出现原因 你请求获取到的内容不是utf 编码,如果是utf 编码可以在decode 中不写,默认utf 三 解决方案 首先查看你要爬取网页的内容的编码格式,如下图 如果非utf 编码,就需要在decode 函数中标明,比如我应该写为:cont rep.read .decod ...

2020-04-07 10:38 0 1814 推荐指数:

查看详情

 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM