UnicodeDecodeError: 'gbk' codec can't decode byte 0xac in position 32: illegal multibyte sequence
时间: 2023-10-22 16:30:01 浏览: 168
你遇到的错误是UnicodeDecodeError: 'gbk'编解码器无法解码非ASCII字符的问题。这是因为Python默认使用的编码方式(GBK)无法正确解码包含非ASCII字符的文件。解决这个问题的方法有两种。第一种方法是修改文件的编码方式为UTF-8或其他支持中文的编码方式。第二种方法是在打开文件时指定文件的编码方式,例如使用`open(path, encoding='utf-8')`来打开文件。这样就可以确保Python能够正确地解码文件中的非ASCII字符。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [pyquery报错:UnicodeDecodeError: ‘gbk’ codec can’t decode byte](https://download.csdn.net/download/weixin_38665944/13751270)[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* *3* [UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xac in position 14: illegal multibyte sequence...](https://blog.csdn.net/yang___y/article/details/131253063)[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 ]
阅读全文