UnicodeDecodeError: 'gbk' codec can't decode byte 0x93 in position 55477: illegal multibyte sequence
时间: 2023-09-26 13:10:51 浏览: 82
这个错误通常表示在执行解码操作时,使用了错误的编码格式,导致无法正常解码某些字符。具体地说,'gbk'编码器尝试解码一个字节串,但发现该字节串中存在0x93字节,而该字节不符合 'gbk' 编码格式,因此抛出了 UnicodeDecodeError 异常。要解决这个问题,需要将编码格式设为正确的格式。可以尝试将编码格式改为'utf-8'来解决这个问题。具体的解决方案是修改代码中的编码参数,将其设置为'utf-8',例如:textFile = open("7.1.txt", encoding='utf-8', "rt")。这样就能够正确解码包含中文字符的文本文件了。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* [成功解决UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xa6 in position 2192: illegal ...](https://blog.csdn.net/weixin_56242678/article/details/130899674)[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%"]
- *3* [UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xad in position 2: illegal multibyte sequence](https://blog.csdn.net/weixin_45857665/article/details/116104722)[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 ]
阅读全文