import MySQLdb
db = MySQLdb.connect("localhost","testuser","test123","TESTDB" )
cursor = db.cursor(MySQLdb.cursors.DictCursor)
results = cursor.fetchall()
pymysql一样适用
来源:51CTO
作者:丿灬安之若死
链接:https://blog.csdn.net/mp624183768/article/details/101103146