#!/usr/bin/env python
# _*_ coding:utf-8 _*_
import MySQLdb
import sys
str = raw_input("please input error code:")
conn = MySQLdb.connect(host='127.0.0.1', user='root', passwd='123456', db='error_code',charset='utf8')
cur = conn.cursor()
sql ="select * from error_message where code = " + "'" + str + "'"
cur.execute(sql)
data=cur.fetchall()
print "分类:"+data[0][0].encode("UTF-8"),"错误码:"+data[0][1].encode("UTF-8"),"错误描述:"+data[0][2].encode("UTF-8"),"相关业务方:"+data[0][3].encode("UTF-8")
cur.close()
conn.close()
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe5 in position 0: ordinal not in range(128)