37,741
社区成员
发帖
与我相关
我的任务
分享
#encoding=utf-8
import MySQLdb
db=MySQLdb.connect(user='root',passwd='123456',db='test',charset='utf8')
cur=db.cursor()
cur.execute('select * from test1')
f=file("f:\\1.txt",'w')
for i in cur.fetchall():
print i[0],i[1]
f.close()
cur.close()
#encoding=utf-8
import MySQLdb
db=MySQLdb.connect(user='root',passwd='123456',db='test',charset='utf8')
cur=db.cursor()
cur.execute('select * from test1')
f=file("f:\\1.txt",'w')
for i in cur.fetchall():
print i
f.close()
cur.close()