Python 查询数据库 显示字段名

db = MySQLdb.connent(host=server_config["mysql_web"]["host"],port=server_config["mysql_web"]["port"],user=server_config["mysql_web"]["user"],passwd=server_config["mysql_web"]["password"],db=server_config["mysql_web"]["database"])

#设置游标  查询出来的数据才会带上字段名
db_cur = db.cursor(MySQLdb.cursors.DictCursor)   

#设置游标  查询出来的数据才会带上字段名
db_cur = db.cursor(MySQLdb.cursors.DictCursor)
  

posted @ 2022-01-25 18:05  树下水月  阅读(512)  评论(0编辑  收藏  举报