美文网首页
2018-08-01mysql-python

2018-08-01mysql-python

作者: 加勒比海带_4bbc | 来源:发表于2018-08-01 16:55 被阅读0次

coding=utf-8

import pymysql

连接数据库

db = pymysql.connect(host='61.164.208.174',user='root_read',passwd='12345,abcde',db='db_rcld_zj_statistics',port=39306,charset='utf8')
cursor = db.cursor()
cursor.execute('SELECT * FROM t_acq_data_20160830 where SHIP_ID =30698')

得到所有数据

res = cursor.fetchall()
for i in res:
print(i)

得到一条数据

res = cursor.fetchone()

print(res)

相关文章

网友评论

      本文标题:2018-08-01mysql-python

      本文链接:https://www.haomeiwen.com/subject/rlurvftx.html