Python查询MySQL
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
·
#coding=utf-8
import sys
import MySQLdb
db = 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()
更多推荐



所有评论(0)