python操作mysql基础之select
# -*- coding: utf-8 -*- import MySQLdb conn = MySQLdb.connect(host='127.0.0.1',user='root',passwd='root',db='cb',port=3306,charset='utf8') cur = conn.cursor() goods = cur.execute("select goods_name from es_goods where goods_id=59") esGoods = cur.fetchmany(goods) for i in esGoods: print i[0] cur.close conn.commit() conn.close
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
【推荐】博客园的心动:当一群程序员决定开源共建一个真诚相亲平台
【推荐】开源 Linux 服务器运维管理面板 1Panel V2 版本正式发布
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步