python读取文件出现字符编码错误

UnicodeDecodeError: 'gbk' codec can't decode byte 0xbf in position 2: illegal multibyte sequence

在某种情况下忽略字符错误

file = open(path, encoding='gb18030', errors='ignore')
原文地址:https://www.cnblogs.com/Leechg/p/14311932.html