python mysql结果查询
来源:互联网 发布:免费内部通讯软件 编辑:程序博客网 时间:2024/05/21 09:21
def ShowDelData():
try:
conn=MySQLdb.Connect(host='localhost',user='po',passwd='password',db='test',charset = 'utf8',port = 3306)
cur=conn.cursor()
count = cur.execute('select * from testtable')
print '共有 %s 条记录'%count
results = cur.fetchall()
for r in results:
a=0
while a < len(r):
print r[a]
a=a+1
print " "
cur.execute('drop table testtable')
print'数据表删除完成(每次搜索结果都新建表,搜索结束删除)'
cur.close()
conn.close()
except MySQLdb.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])
try:
conn=MySQLdb.Connect(host='localhost',user='po',passwd='password',db='test',charset = 'utf8',port = 3306)
cur=conn.cursor()
count = cur.execute('select * from testtable')
print '共有 %s 条记录'%count
results = cur.fetchall()
for r in results:
a=0
while a < len(r):
print r[a]
a=a+1
print " "
cur.execute('drop table testtable')
print'数据表删除完成(每次搜索结果都新建表,搜索结束删除)'
cur.close()
conn.close()
except MySQLdb.Error,e:
print "Mysql Error %d: %s" % (e.args[0], e.args[1])
0 0
- python mysql结果查询
- 利用python将hive查询结果保存到mysql
- python mysql中查询数据,结果中文显示乱码
- python查询mysql导出结果至Excel并发送邮件
- mysql查询结果合并
- mysql合并查询结果
- [mysql]导出查询结果
- [mysql]导出查询结果
- 导出mysql查询结果
- mysql查询结果合并
- mysql合并查询结果
- mysql 查询结果不正确
- mysql查询结果编号
- mysql 导出查询结果
- python -- 获取 bing 查询结果
- python查询数据库结果返回
- mysql查询结果分页显示
- mysql 查询取结果集
- CodeIgniter实现读写分离
- linux之SQL语句简明教程---主键,外来键
- 【006】Objective-C中NSLog的格式
- Longest Valid Parentheses
- Speed Up Octopress with InstantClick
- python mysql结果查询
- 易语言 TCP支持库
- 二进制在数学中的妙用(转帖)
- 黑马程序员——Foundation框架——NSString
- csdn站内搜索结果爬虫
- 第16周项目2-用指针玩字符串(1)字符串连接
- (下拉框系列1)下拉框Html.DropDownList 和DropDownListFor 的常用方法
- Mysql无法创建外键的原因
- KNN(k近邻算法)