码迷,mamicode.com
首页 > 数据库 > 详细

python链接mysql数据库

时间:2016-08-15 12:57:55      阅读:148      评论:0      收藏:0      [点我收藏+]

标签:

import pymysql.cursors

connection = pymysql.connect(host=‘172.16.250.156‘,
                             user=‘xedk‘,
                             password=‘admin‘,
                             db=‘xedk‘,
                             charset=‘utf8mb4‘,
                             port=3308,
                             cursorclass=pymysql.cursors.DictCursor)
cursor=connection.cursor()
cursor.execute("select * from AC_LN_LO where LOAN_NO = ‘cz201405261115079828‘")
result = cursor.fetchall()#fechone()

for a in result:
    print a
print len(result)

python链接mysql数据库

标签:

原文地址:http://www.cnblogs.com/jerryhua/p/5772402.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!