UnicodeDecodeError:'charmap'编解码器无法解码位置7736的字节0x98:字符映射到<undefined>
def ReadAllText(path):
r = open(path.replace("\\x", "%"))
text = r.read()
r.close()
return text
有人可以帮我吗?
答案 0 :(得分:0)
它不能解决问题,但是一种解决方法是将文本文件保存为ANSI编码,然后再次运行脚本。
另一个想法是像这样打开文件:
open(file, errors='ignore')