1.报错截图:
2.报错代码:
b = [x for x in open('F://3m-q-200427//result.txt').readlines() if x.find('words_str')>-1]
with open('F:/3m-q-200427/wordstr.txt','w') as f:
f.writelines(b)
print("finish")
3.解决方法:
b = [x for x in open('F://3m-q-200427//result.txt','r',encoding='UTF-8').readlines() if x.find('words_str')>-1]
with open('F:/3m-q-200427/wordstr.txt','w') as f:
f.writelines(b)
print("finish")