UnicodeDecodeError: 'utf-8' codec can't decode byte 0xb9 in position 16: invalid start b

Posted 邓戈麟

tags:

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

 

读取一个csv文件失败,提示:

UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xb9 in position 16: invalid start byte

 

解决办法:使用Notepad++打开该csv文件,然后转为UTF-8编码

 

1 import csv
2 csv_reader=csv.reader(open(P020180206560372967623.csv,encoding=utf-8))
3 for row in csv_reader:
4     print(row)

 

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

python编码问题:UnicodeDecodeError: 'gbk' codec can't decode

python UnicodeDecodeError: 'ascii' codec can't decode byte ...

UnicodeDecodeError: 'ascii' codec can't decode byte错误解决方案

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd

UnicodeDecodeError: 'utf-8' codec can't decode byte..问题

UnicodeDecodeError: 'utf-8' codec can't decode byte..问题