原文:python錯誤:UnicodeDecodeError: 'utf8' codec can't decode byte 0xe6 in position 0: unexpected end of data

一 錯誤原因 在學習selenium自動化測試框架的時候,進行模仿瀏覽器搜索功能,輸入英文是沒問題,但是輸入中文就報錯,報錯代碼 報錯內容:UnicodeDecodeError: utf codec can t decode byte xe in position : unexpected end of data 二 解決辦法 在中文后加.decode utf 設置為utf ...

2017-09-05 15:06 0 10440 推薦指數:

查看詳情

解決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