python 设置mysql查询返回的数据类型为字典
方案
class DBUtil: def __init__(self, host, database, user, password, port): self.connect = pymysql.Connect( host=host, database=database, user=user, password=password, port=port, charset='utf8mb4', cursorclass=pymysql.cursors.DictCursor -----此处是关键 )
知道、想到、做到、得到