Python查询MySQL

来源:互联网 发布:武侠手游推荐 知乎 编辑:程序博客网 时间:2024/05/21 15:41

Python MySQL 连接

#coding=utf-8import sysimport MySQLdbdb = MySQLdb.connect(user='root',charset='utf8')cur =db.cursor();cur.execute('use test')cur.execute('select account_name from account')for row in cur.fetchall():print row[0]cur.close()db.close()




参考原文地址点击这里


原创粉丝点击