import pymysql
db = pymysql.connect(host='',
port=3306,
user='',
password='')
cursor_dict = db.cursor(cursor=pymysql.cursors.DictCursor)
sql = ''
data = cursor_dict.execute(sql)
print(data)
python查询数据库结果返回字典格式
最新推荐文章于 2024-07-18 15:48:54 发布