python json 中文 unicode
时间: 2023-10-04 15:05:43 浏览: 246
python处理json数据中的中文
5星 · 资源好评率100%
回答: 在Python的json库中,当使用dumps函数将中文转换为json字符串时,默认会将中文转换为Unicode编码,并以16进制方式存储。这是因为Python3将Unicode作为默认编码。如果想要显示中文而不是Unicode编码,可以在dumps函数中添加参数ensure_ascii=False。这样就可以将中文以原始形式显示出来。\[1\]\[2\]你可以参考这个链接了解更多信息:https://stackoverflow.com/questions/956867/how-to-get-string-objects-instead-of-unicode-from-json。
#### 引用[.reference_title]
- *1* [python2下解决json的unicode编码问题](https://blog.csdn.net/weixin_35514865/article/details/113480461)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [解决Python3将数据保存为json,中文显示为Unicode编码的问题](https://blog.csdn.net/fyfugoyfa/article/details/122373856)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [python json unicode utf-8处理总结](https://blog.csdn.net/weixin_39751453/article/details/111430758)[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^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文