0
我無法打開一個html文件在閱讀模式來搜索其來源中的字符串匹配。打開html文件來閱讀它的來源搜索特定標記
fo = open("htm1.html", "r");
str = fo.read(10);
print("Read String is : ", str);
fo.close();
這是行不通的。我收到以下錯誤:
Traceback (most recent call last):
File "C:/Python33/myProjects/malCode.py", line 34, in <module>
str = fo.read(10);
File "C:\Python33\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 6040: character maps to <undefined>