python 'utf-8' codec can't decode byte 0xb8 in position 0: invalid start byte

Posted zhichun

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python 'utf-8' codec can't decode byte 0xb8 in position 0: invalid start byte相关的知识,希望对你有一定的参考价值。

技术图片

 

 

在导入csv文件中,出现如上所示的错误,经过查阅资料,解决方法如下:

方法一:

pd.read_csv(file_path, encoding=‘unicode_escape‘)

方法二:

pd.read_csc(file_path.encoding=‘gbk‘)

以上是关于python 'utf-8' codec can't decode byte 0xb8 in position 0: invalid start byte的主要内容,如果未能解决你的问题,请参考以下文章

html解码('utf-8')csv双行(python 3)

用Python 抓取的UTF8网页无法decode('utf-8')

Python sys.setdefaultencoding('utf-8') 后就没输出

python3:(unicode error) 'utf-8' codec can't decode

python中sys.setdefaultencoding('utf-8')的作用

python中sys.setdefaultencoding('utf-8')的作用