etree 报错UnicodeDecodeError: 'gbk' codec can't decode byte 0xae in position 5738: illegal multibyte sequence
时间: 2023-09-25 14:14:49 浏览: 152
这个UnicodeDecodeError错误是由于编码问题导致的。根据引用和引用,这个错误可能是由于在处理XML文件时遇到了包含非法多字节序列的字符。为了解决这个问题,可以参考引用中的建议,使用utf-8编码格式打开XML文件。在代码中,将打开文件的encoding参数设置为'utf-8',例如将in_file = open(os.path.join(root, image_id))改为in_file = open(os.path.join(root, image_id), encoding='utf-8')。这样就可以避免UnicodeDecodeError错误的出现。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [YOLOv7保姆级教程(个人踩坑无数)----训练自己的数据集](https://blog.csdn.net/weixin_55749226/article/details/128480595)[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^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [UnicodeDecodeError: ‘gbk‘ codec can‘t decode byte 0xae in position 136: illegal multibyte ...](https://blog.csdn.net/weixin_63132747/article/details/128753278)[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^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文