首页 > 代码库 > 收集部门人员一次二次推荐python脚本--参考
收集部门人员一次二次推荐python脚本--参考
#!/usr/bin/env python #encoding:utf-8 import MySQLdb tell_file=‘/home/test/liyiliang/study/tell.info‘ f = file(tell_file) account_list = f.readlines() f.close() for n in account_list: h=n.strip().split() name = h[0] phone = h[1] try: conn = MySQLdb.connect(host=‘x.x.x.x‘,user=‘xxxx‘,passwd=‘xxxxxxx‘,port=xxxxx,charset=‘utf8‘) cur = conn.cursor() cur.execute(‘select promotioncode from cinf_db.cinf_promotioncode where mp = %s‘,phone) mycode = cur.fetchall() numTwo=0 for code in mycode: cur.execute(‘select mp from cinf_db.cinf_promotioncode_reward_history where reward_type=1 and promotioncode = %s‘,code) op = cur.fetchall() cur.execute(‘select count(*) from cinf_db.cinf_promotioncode_reward_history where reward_type=1 and promotioncode= %s ‘,code) mynum = cur.fetchall() for opnum in op: cur.execute(‘select promotioncode from cinf_db.cinf_promotioncode where mp = %s‘,opnum) othercode = cur.fetchall() for oc in othercode: cur.execute(‘select count(*) from cinf_db.cinf_promotioncode_reward_history where reward_type=1 and promotioncode = %s‘,oc) everone = cur.fetchall() for a in everone: b=int(a[0]) numTwo += b for numOne in mynum: print ‘%s‘ %name, print ‘%s‘ %phone, print ‘%s‘ %numOne, print ‘%s‘ %numTwo cur.close() conn.close() except MySQLdb.Error,e: print "MySQLdb Error",e
本文出自 “Chocolee” 博客,谢绝转载!
收集部门人员一次二次推荐python脚本--参考
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。