使用json.dumps(user, ensure_ascii=False)
user = {"id": 101, "name": "张三"}
print(json.dumps(user))
{"id": 101, "name": "\u5f20\u4e09"}
print(json.dumps(user, ensure_ascii=False))
{"id": 101, "name": "张三"}
使用json.dumps(user, ensure_ascii=False)
user = {"id": 101, "name": "张三"}
print(json.dumps(user))
{"id": 101, "name": "\u5f20\u4e09"}
print(json.dumps(user, ensure_ascii=False))
{"id": 101, "name": "张三"}
本文标题:json.dumps不把中文转义的方式
本文链接:https://www.haomeiwen.com/subject/sgbxmktx.html
网友评论