python mysql to dict
cursor.execute(sql)
rows = cursor.fetchall()
result_list = []
columns = [desc[0] for desc in cursor.description] # get column names
for row in rows:
result_list.append(dict(zip(columns, row)))
data['result'] = result_list
本文来自博客园,作者:vx_guanchaoguo0,转载请注明原文链接:https://www.cnblogs.com/guanchaoguo/p/17982816