请问我这段python代码哪里有问题?
f1=open('论语-网络版.txt','r+')f2=open('论语-提取版.txt','w+')forlinf1.readlines():list=[]forii...
f1=open('论语-网络版.txt','r+')
f2=open('论语-提取版.txt','w+')
for l in f1.readlines():
list=[]
for i in l:
if i not in ['\n',' ']:
list.append(i)
if list!=[]:
f2.writelines(''.join(list)+'\n')
f1.close()
f2.close()
每次都报错,报错内容如下:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 4: illegal multibyte sequence 展开
f2=open('论语-提取版.txt','w+')
for l in f1.readlines():
list=[]
for i in l:
if i not in ['\n',' ']:
list.append(i)
if list!=[]:
f2.writelines(''.join(list)+'\n')
f1.close()
f2.close()
每次都报错,报错内容如下:
UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 4: illegal multibyte sequence 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询