问题相关代码,请勿粘贴截图
import os
filepath='E:\\SLNData\\rec_imgs\\test_gt\\412016760_0_crop_0.txt'
# filepath='E:\\SLNData\\rec_imgs\\test_gt\\412016320_0_crop_1.txt'
with open(filepath,'r', encoding='gbk') as f:
for line in f.readlines():
print(line)
运行结果及报错内容
412016320_0_crop_1.txt的文件内容可以正常打印输出,但412016760_0_crop_0.txt的内容存在问题。
我想要达到的结果
因为需要把多个文本内容合并,如果直接errors='ignore',导致合并的文本内容存在这样的问题