import json  

dict = {'Title': '这是标题'}
print json.dumps(dict, ensure_ascii=False, encoding='UTF-8')
#结果: {"Title": "这是标题"}

【转自】:http://blog.csdn.net/zhangchaoy/article/details/19337841

【转】Python 字典中的中文输出问题的更多相关文章

  1. python字典中显示中文

    #coding=utf-8import jsondict={'title':"这是中文"}print json.dumps(dict,ensure_ascii=False,enco ...

  2. 实验:将系统进程映射移到 Python 字典中

    参考官方文档,测试下列代码,把oracle的进程映射到python的字典中: [oracle@ycr python]$ more pro_get.py import reimport subproce ...

  3. python字符串中的中文处理

    python字符串中的字符串默认并非是unicode,如果在字符创中使用Unicode字符,如中文字符,必须要经过转换, 方式1: text = u"中文" 方式2: text = ...

  4. 解决python代码中含有中文报错

    python中写入中文时报错如下图所示: 依照网上解决方法:在py文件中加入:#encoding=utf-8 然后继续报错如下图所示: 解决方法: 在py文件中加入: import sysreload ...

  5. 判断python字典中key是否存在的两种方法

    今天来说一下如何判断字典中是否存在某个key,一般有两种通用做法,下面为大家来分别讲解一下: 第一种方法:使用自带函数实现. 在python的字典的属性方法里面有一个has_key()方法,这个方法使 ...

  6. 关于python Tk中实时的输出.

    源码如下: import time from Tkinter import * def run(): while True: txt.insert(END,'...') print '...' tim ...

  7. python字典中的元素类型

    python字典默认的是string item={"browser " : 'webdriver.irefox()', 'url' : 'http://xxx.com'} 如果这样 ...

  8. python字典中添加项

    body_daily_close = { "mappings": { "properties": { "trade_date": { &qu ...

  9. 十四、python字典中的方法汇总

    '''1.访问.修改,删除字典中的值:''' dict={'a':'11','b':'22','c':'33','d':'44'}print dict['a'],dict['d'] #访问dict[' ...

随机推荐

  1. HDUOJ-----Robot Motion

    Robot Motion Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (Java/Others)Tota ...

  2. linux shell 脚本攻略学习9--rename命令详解

    rename命令详解: 对文件重命名是常用的操作之一,一般对单个文件的重命名用mv命令,如: amosli@amosli-pc:~/learn/example$ ls abc.txt amosli@a ...

  3. LAMP环境搭建实现网站动静分离[转]

    目录: 1.环境概述 2.动静分离拓扑图 3.各服务器功能规划 4.各服务器基础环境配置 5.httpd安装配置 6.php安装配置及启用opcache加速功能 7.mysql安装配置 8.wordp ...

  4. 关于新加坡IT薪酬和找工作网站

    关于新加坡IT薪酬 很多朋友发邮件或留言问我关于新加坡IT薪酬的问题,由于前段时间比较忙,所以没有及时一一回复,在此表示抱歉. 新加坡IT薪酬范围大概如下(月薪,新加坡币对人民币为1:5): Juni ...

  5. C++中四种类型转换方式(ynamic_cast,const_cast,static_cast,reinterpret_cast)

    Q:什么是C风格转换?什么是static_cast, dynamic_cast 以及 reinterpret_cast?区别是什么?为什么要注意? A:转换的含义是通过改变一个变量的类型为别的类型从而 ...

  6. React(0.13) 定义一个使用动画

    <!DOCTYPE html> <html> <head> <title>React JS</title> <script src=& ...

  7. hibernate使用注解设置日期默认值

    用注解设置属性的默认值时 使用 @Temporal(TemporalType.TIMESTAMP) @Column(updatable = false,nullable=false,length=20 ...

  8. mysqld Can’t start server : Bind on unix socket: Permission denied

    启动mysql报错: mysqld Can’t start server : Bind on unix socket: Permission denied 原因: mysql.sock无法建立,权限问 ...

  9. struts系列:校验(一)XML校验和函数方法校验

    一.jsp示例 <form action="login" method="post"> <div class="form-group ...

  10. Jedis工具类(含分布式锁的调用和释放)

    个人把工具类分为两部分: 一.连接池部分 import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.j ...