python mysql模块

时间:2014-07-02 16:14:12   收藏:0   阅读:285

#!/usr/bin/python

import MySQLdb


def new_mail_mysql(ak):

    print ak

    conn=MySQLdb.connect(host=‘m3306.sae.sina.com.cn‘,user=‘sae_ol‘,passwd=‘7b149edb22ae7526‘,db=‘sae‘,port=3306)

    cur=conn.cursor()

    sql="select name from app where accesskey=‘%s‘"%ak

    cur.execute(sql)

    app_name=cur.fetchall()

    return app_name

    cur.close()

    conn.close()


if __name__ == ‘__main__‘:

    ak=new_mail_mysql(‘4yywo5lm02‘)

    print ak


本文出自 “expect批量同步数据” 博客,请务必保留此出处http://4249964.blog.51cto.com/4239964/1433462

python mysql模块,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!