UnicodeDecodeError:'utf-8' codec can't decode byte 0xb9 in position 0: invalid start byte

问题描述

问题原因

在国内的话,一般就是GBK比较多了,Windows默认是gbk,所以打开一些文件会这样

解决方案

在读写文件过程中加上utf-8编码格式

with open(you_file_path, 'r', encoding='utf-8') as f:
    f_content = f.read()
    pass