UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 384: invalid continuation by
时间: 2023-08-28 17:20:49 浏览: 113
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd5 in position 2: invalid continuation byte-附件资源
当你在使用Python的pandas库中的read_csv()函数读取CSV文件时出现UnicodeDecodeError错误,这意味着你的编码方式不兼容。这个错误通常发生在文件中包含非UTF-8编码的字符时。为了解决这个问题,你可以尝试以下几种方法来处理这个错误:
1. 使用`encoding`参数: 可以尝试使用不同的编码方式来读取文件。你可以在read_csv()函数中使用`encoding`参数来指定编码方式,例如 `encoding='utf-8-sig'` 或者 `encoding='latin1'`。这些编码方式可以尝试解码包含非UTF-8字符的文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [UnicodeDecodeError: ‘utf-8‘ codec can‘t decode byte 0xd3 in position 0: invalid continuation byte...](https://blog.csdn.net/qq_52381360/article/details/127938548)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [UnicodeDecodeError: ‘utf-8’ codec can’t decode byte 0xd5 in position 0: invalid continuation byte](https://blog.csdn.net/qq_45860901/article/details/127309510)[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^v92^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文