复盘: file_path = r'C:\Users\10464\Desktop\新建文件夹\新建文本文档.txt' with open(file_path, 'r', encoding="utf-8") as file: content = file.read() print(content)
尝试很久,最后发现核心问题在于encoding="utf-8"
原电脑python编码应该是 'gbk' codec can't decode byte
编码不兼容
复盘: file_path = r'C:\Users\10464\Desktop\新建文件夹\新建文本文档.txt' with open(file_path, 'r', encoding="utf-8") as file: content = file.read() print(content)
尝试很久,最后发现核心问题在于encoding="utf-8"
原电脑python编码应该是 'gbk' codec can't decode byte
编码不兼容