# 读取目标文件
try:
with open(file_path, 'r', encoding='UTF-8') as f:
str_ori = f.read()
except:
with open(file_path, 'r', encoding='gb18030', errors='ignore') as f:
str_ori = f.read()
finally:
if f in locals():
f.close()
'gbk' codec can't decode byte ... 的解决办法
最新推荐文章于 2021-07-02 10:58:01 发布