前端开发,CIW 认证在国内有多大中国的影响力有多大

中文乱码问题,请高手解答!!!
#-*- coding:utf-8 -*-
import MySQLdb
conn = MySQLdb.Connect(
host = '127.0.0.1',
user = 'root',
#密码部分处于隐私就这样表示一下
passwd = ******,
port = 3306,
db = 'imooc',
charset = 'utf8'
cursor = conn.cursor()
sql = "SELECT * FROM tdb_goods"
cursor.execute(sql)
print cursor.rowcount
rs = cursor.fetchone()
#中文可以正常显示
print 'goods_id:%d, goods_name:%s'%(rs[0], rs[1])
#中文不能正常显示
cursor.close()
conn.close()代码如上,显示的结果如下:C:\Python27\python.exe C:/LearnPython/MySQL_Python/CursorTest.py21goods_id:1, goods_name:R510VC 15.6英寸笔记本(1, u'R510VC 15.6\u82f1\u5bf8\u7b14\u8bb0\u672c', 5, 2, Decimal(''), 1, 0)Process finished with exit code 0那么,为什么print 'goods_id:%d, goods_name:%s'%(rs[0], rs[1])可以正常显示中文,而print rs不行呢???
写下你的评论...
写下你的评论...
Copyright (C)
All Rights Reserved | 京ICP备 号-22009年12月 PHP大版内专家分月排行榜第二2009年5月 PHP大版内专家分月排行榜第二2009年2月 PHP大版内专家分月排行榜第二2009年1月 PHP大版内专家分月排行榜第二
2009年9月 PHP大版内专家分月排行榜第三2009年3月 PHP大版内专家分月排行榜第三
2009年12月 PHP大版内专家分月排行榜第二2009年5月 PHP大版内专家分月排行榜第二2009年2月 PHP大版内专家分月排行榜第二2009年1月 PHP大版内专家分月排行榜第二
2009年9月 PHP大版内专家分月排行榜第三2009年3月 PHP大版内专家分月排行榜第三
本帖子已过去太久远了,不再提供回复功能。

我要回帖

更多关于 一个人的影响力有多大 的文章

 

随机推荐