首页 > 编程语言 > 详细

python 基本查找插入

时间:2015-01-29 02:02:09      阅读:234      评论:0      收藏:0      [点我收藏+]
import MySQLdb
import time
try:
    conn=MySQLdb.connect(host=‘localhost‘,user=‘root‘,passwd=‘‘,db=‘abin‘,port=3306)
    cur=conn.cursor()
    result=cur.execute(‘select * from tabin‘)
    print result
    print ‘-------‘
    info=cur.fetchmany(result)
    for ii in info:
        currentTime = time.strftime(‘%Y-%m-%d %H:%M:%S‘,time.localtime(time.time()))
        values=[ii[1],currentTime]
        cur.execute(‘insert into sabin (name,create_time) values (%s,%s)‘,values)
        print ‘====‘
    cur.close()
    conn.commit()
    conn.close()
except MySQLdb.Error,e:
    print "Mysql Error %d: %s % ()e.args[0],e.args[1]"



import urllib
params = urllib.urlencode({‘type‘:‘mobile‘,‘parameter‘:‘13521502037‘,‘pageNum‘:1,‘pageSize‘:10})
conn = urllib.urlopen("http://test.qunar.com:7400/complaints/find.action",params);
result = conn.read()
print result

python 基本查找插入

原文:http://www.blogjava.net/stevenjohn/archive/2015/01/28/422504.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!