import MySQLdb
import MySQLdb.cursors
conn = MySQLdb.connec('localhost','root','test456','db_test',charset='utf8',cursorclass = MySQLdb.cursors.DictCursor)
import MySQLdb.cursors
conn = MySQLdb.connec('localhost','root','test456','db_test',charset='utf8',cursorclass = MySQLdb.cursors.DictCursor)
转载于:https://blog.51cto.com/linuxshow/779521