如下所示:
import MySQLdb
import json
def getSql():
try:
con = MySQLdb.connect(host='localhost', user='', passwd='', db='test', charset='utf8')
cursor = con.cursor()
sql = "select * from user"
cursor.execute(sql)
results = cursor.fetchmany(5)
users = []
data = {}
for r