UnicodeEncodeError: 'gbk' codec can't encode character '\xbb' in position 156788: illegal multibyte sequence
可以统一采用utf-8编码
with open("file", "w", encoding="utf-8") as file:
file.write(data)
也可以忽略错误
with open("file", "w", errors='ignore') as file:
file.write(data)
上面的两种方法都可以避免报错,但是更建议采用第一种方式,第二种方式仍然会存在无法编码的字符