python : 'gbk' codec can't decode byte 0xbe in position 18: illegal multibyte sequenc

在使用python时经常会遇到一些编码的错误

例如'gbk' codec can't decode byte 0xbe in position 18: illegal multibyte sequenc


源代码片段为

很明显从错误中我们可以指导,这是因为文本文档采用的是gbk编码,这个时候我们需要转换成python能识别的编码,比如utf-8



猜你喜欢

转载自blog.csdn.net/weixin_41931602/article/details/80557416