原文:python爬蟲 報錯UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb5 in position 150: invalid start b

我今天在學習Python用代理ip 訪問網頁的時候 報了以上錯誤 在網上找了幾種方法不是崩潰就是報錯 比如這種: html response.read .decode utf , ignore 在這句話后面加 ignore 感覺好暴力 但是崩潰了 最后我想到直接用 GBK 編碼模式就好啦 html response.read .decode GBK 完美運行 沒有報錯 最后附上完整代碼: impo ...

2020-04-14 21:30 0 1372 推薦指數:

查看詳情

 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM