解码错误处理
我有一个d:\sc.doc文档,文档内容是我是中国共产党员。用with open("d:\\sc.doc",'r',1) as f:
data=f.read()
运行后出现下列错误,请问怎样处理。谢谢
Traceback (most recent call last):
File "C:\Program Files\147.py", line 2, in <module>
data=f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xb1 in position 5: illegal multibyte sequence