原文:解決python錯誤 UnicodeDecodeError: 'gb2312' codec can't decode byte 0x8b in position 1: illegal multibyte sequence

報錯的代碼: url http: kaijiang. .com shtml ssq .shtml page urllib.request.urlopen url content page.read .decode gb 報這個錯的原因是獲取到的網頁內容是經過壓縮了的,打開url可以看到請求head 一種方式是請求時把Accept Encoding設為空,這樣的話網頁數據未壓縮,會相對比較大,增加網 ...

2019-05-10 23:33 0 2121 推薦指數:

查看詳情

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