Skip to content

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

原文链接:https://ceshiren.com/t/topic/31792