python 二、python讀取.htm文件報錯:UnicodeDecodeError: 'utf8' codec can't decode byte 0xb3 in position 0的解決方法

問題是這樣的:我用python寫的程序去讀取.htm文件中的數據,剛開始我用:fr = open("0.htm" , "r")時,程序運行後直接崩潰,後來根據提示的錯誤信息:ValueError encoding must be one of 'utf_8','big5', or 'gbk'.,所以我用codecs改寫成以下形式:html - coding: utf-8 - import sys
相關文章
相關標籤/搜索