文件打开报错
请教一下版主:每次打开都报错,当吧txt文档汉字去掉就不会报错,请指教
>>> f=open('d:\\keywords.txt')
>>> f
<_io.TextIOWrapper name='d:\\keywords.txt' mode='r' encoding='cp936'>javascript:;
>>> f.read()
Traceback (most recent call last):
File "<pyshell#71>", line 1, in <module>
f.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 52: illegal multibyte sequence 请使用正确编码打开文件 f=open('d:\\keywords.txt',encoding='utf-8') 逃兵 发表于 2021-3-10 08:06
{:5_106:}
页:
[1]