赞
踩
import pymysql
import pandas as pd
connect = pymysql.connect(host="IP",port=3306,user="user",password="password",database="database",charset="utf8")
cur = connect.cursor()
sql = '数据库语句 '
# 查询到的数据条数
res = cur.execute(sql)
print(res)
# 4、获取查询到的数据
# 方法一:获取一条查询数据
data_all = cur.fetchall()
print(data_all)
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。