Python UnicodeEncodeError: 'gbk' codec can't encode character
1.如果文件是txt文件,检查文件的编码方式,建议另存为,将编码方式改为utf-8
2.打开文件时加上encoding
如:with open(“dict_doc.txt”,encoding=“utf-8”) as get:
3.在打开文件时再加上errors
如:with open(txt_name, encoding=“utf8”,errors=“ignore”)as f: