python UnicodeDecodeError: 'utf-8' codec can't decode byte 0xf9 in position 6: invalid start byte
时间: 2023-09-24 10:13:25 浏览: 100
python解决汉字编码问题:Unicode Decode Error
这个报错通常是因为在使用utf-8编码时,遇到了无效的起始字节。根据引用,该错误在位置6遇到了字节0xf9,这是一个无效的起始字节。引用提到了一种可能的原因,即将生成的图像文件和csv数据文件存储在同一个目录下,导致在继续遍历文件时读取到了这个jpg文件,而无法用utf-8格式进行读取。解决这个问题的方法是将图像文件和csv数据文件存储在不同的目录中,以避免读取到错误的文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [解决python报错UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xff in position 0: invalid ...](https://blog.csdn.net/weixin_51143190/article/details/126125099)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
- *2* [UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 2: invalid continuation byte-...](https://download.csdn.net/download/weixin_42204453/15589184)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文