Python 字典中包含中文的输出
来源:互联网 发布:赵薇杀人知乎 编辑:程序博客网 时间:2024/05/17 04:18
#!coding=utf8import jsontmp = {1:123, 2:345, 4: '汉字'}tmp_json_1 = json.dumps(tmp)tmp_json_2 = json.dumps(tmp, ensure_ascii=False)print tmpprint tmp_json_1print tmp_json_2
输出结果是:
{1: 123, 2: 345, 4: '\xe6\xb1\x89\xe5\xad\x97'}{"1": 123, "2": 345, "4": "\u6c49\u5b57"}{"1": 123, "2": 345, "4": "汉字"}
通常字典中包含中文的时候,如果直接输出,会是 \uxxxx的形式 。
使用json的 dumps 注意 参数 ensure_ascii=False
0 0
- Python 字典中包含中文的输出
- python中遇到包含UTF-8编码中文的列表或字典的输出的解决方法
- python中包含UTF-8编码中文的列表或字典的输出
- 转 python中包含UTF-8编码中文的列表或字典的输出
- [python]包含中文的list输出时乱码
- Python 字典中的中文输出问题
- python 整体输出字典中的中文
- Python 字典中的中文输出问题
- python中不能输出中文的解决方法
- eclipse 中运行包含中文的Python程序
- Python查找文件中包含中文的行
- sublime中python中文输出
- python 中字典打印中文问题
- Oracle数据字典中包含的视图
- Python 判断字符串中是否包含中文
- 关于python在cmd中输出中文乱码的问题
- Python字典按值排序、包含字典的列表按字典值排序的方法
- Python字典按值排序、包含字典的列表按字典值排序的方法
- 《linux设备驱动程序》前期准备工作
- HDU 1686 Oulipo(KMP)
- 将Eclipse代码导入到AndroidStudio的两种方式
- 蓝桥杯 算法训练 最短路 (链式前向星,spfa)
- android .9图片使用和一些技巧
- Python 字典中包含中文的输出
- 基本的Linux命令
- JAVA正则表达式 Pattern和Matcher
- fatal: Not a git repository (or any of the parent directories):
- HDU 1069 Monkey and Banana(DP)
- Android Design Support Library初探-更新中
- PopupWindow 定点弹窗
- 详解CSS选择器、优先级与匹配原理
- 《重构:改善代码的既有设计》读书笔记