python MySQLdb中文乱码解决
IDEA
#!/usr/bin/env python
#coding=gb2312
import MySQLdb
#mysql python 读取中文乱码解决
#db = MySQLdb.Connect(user,pwd,dbip,dbname)
db = MySQLdb.connect(host="localhost", user="root", passwd="root", db="ruby",use_unicode=0, charset='gb2312')
cur = db.cursor()
#cur.execute('set names gb2312')
cur.execute('select * from users')
lT=cur.fetchall()
print lT[0][1]
cur.close()
db.close()