python读取文件时报错。
源代码
train_txt = open("./data/ex1.txt", "r")
解决办法1:
加上 UTF-8 说明
train_txt = open("./data/ex1.txt", "r", encoding="UTF-8")
# 或者
train_txt = open("./data/ex1.txt", "r", encoding="utf_8_sig")
解决办法2:
train_txt = open("./data/ex1.txt", "rb")
但是这个会导致编码是进制格式展示