求教,在连接mysql数据库中,没有制定编码运行成功,但制定了charset='utf=8'会报错
import MySQLdb #why use charset utf-8 will be wrong conn = MySQLdb.Connect( host = '127.0.0.1', port = 3306, user = 'root', passwd = '123456', db = 'pythondb', charset = 'utf-8' ) cursor = conn.cursor() print conn print cursor cursor.close() conn.close()