user_info = {"name" : {"a":23}, "gender" : "系统名", "age": 28} print(user_info,type(user_info)) import json python_to_json1 = json.dumps(user_info, ensure_ascii=False)# print(python_to_json1,type(python_to_json1)) python_to_json2 = json.dumps(user_info)# print(python_to_json2,type(python_to_json2))
python中使用json.dumps 序列化时默认使用的ascii编码,想输出真正的中文需要指定ensure_ascii=False:
最新推荐文章于 2023-03-01 16:00:05 发布