with open(file=file_, mode='rb') as read_file: # print(read_file.read()) # article = '' # for line in read_file: # line = line.decode('utf-8').rstrip('\n') # 删除 string 字符串末尾的指定字符(默认为空格) # if line: # article = article.join(str(line)) # data[file_dir + '/' + file] = ''.join(article) article = read_file.read() data[file_dir + '/' + file] = article.decode('GB2312', errors='ignore') # print(data)
python读取文件编码错误.decode('GB2312', errors='ignore')解决
最新推荐文章于 2024-08-29 04:18:13 发布