Python Throwing “'utf8' codec can't decode byte 0xd0 in position 0” Error

你。 提交于 2019-12-05 01:14:31
Adam Morris

Unicode encoding confuses me, but can't you force the value to ignore invalid bytes by saying:

value = unicode(value, errors='ignore')

Here is a great answer for more reading on unicode: unicode().decode('utf-8', 'ignore') raising UnicodeEncodeError

Wonil

openpyxl only deals with OOXML format (xlsx/xlsm). Please try to save as xlsx file format instead of xls by using Excel.

If you want to convert xls file to xlsx in codes. Please try one option from the below list:

  1. In Windows, you can also use excelcnv tool to convert xls to xlxx.
  2. In Linux, please check this article.
  3. Or, you could convert to xlsx by using xlrd in Python. Please check this Q&A.

Hi Are you sure you don't have a doc that has UTF-8 BOM

You might try using with UTF-8 BOM codec. Generally Windows+UTF+8 can be a bit troublesome. Although that character that it's showing may not be the BOM.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!