pymysql fetchall 查询结果返回字典
2019-06-01 本文已影响0人
HAO延WEI
import pymysql
from pymysql.cursors import DictCursor
connect = pymysql.connect(
host='127.0.0.1',
port=3306,
db='dbname',
user='root',
passwd='',
charset='utf8'
)
cursor = connect.cursor(DictCursor)