hand= MySQLdb.connect(host='localhost',user='hongfu',passwd='hongfu',db='zftest', charset="gbk")
或写成
hand = MySQLdb.connect('localhost','root','root','test','UTF-8')
用最后那个 charset='gbk' 指定数据库使用gbk的编码
hand= MySQLdb.connect(host='localhost',user='hongfu',passwd='hongfu',db='zftest', charset="gbk")
或写成
hand = MySQLdb.connect('localhost','root','root','test','UTF-8')
用最后那个 charset='gbk' 指定数据库使用gbk的编码