原文:爬蟲 -- UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe6 in position 301: unexpected end of data

errors參數有 個值:strict, ignore, replace ...

2019-06-30 21:07 0 767 推薦指數:

查看詳情

解決utf8' codec can't decode byte 0xe5 in position 0: unexpected end of data

使用unicode對象的話,除了這樣使用u標記,還可以使用unicode類以及字符串的encode和decode方法。 unicode類的構造函數接受一個字符串參數和一個編碼參數,將字符串封裝為一個unicode,比如在這里,由於我們用的是utf-8編碼,所以unicode中的編碼參數使用 ...

Wed Mar 27 19:21:00 CST 2019 0 1728
 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM