打开文本问题
我想打开一个文本,弹出以下错误,怎么解决呢>>> e=open('E:\\新建文本文档.txt')
>>> e
<_io.TextIOWrapper name='E:\\新建文本文档.txt' mode='r' encoding='cp936'>
>>> e.read()
Traceback (most recent call last):
File "<pyshell#35>", line 1, in <module>
e.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0xa2 in position 17: illegal multibyte sequence
改成这样:
e=open('E:\\新建文本文档.txt', encoding = "utf-8") 解码问题
页:
[1]