1 import pymysql 2 import pandas 3 db=pymysql.connect(host=‘localhost‘,port=3306,user=‘root‘,database=‘lihao‘,password=‘lh19990317‘) 4 #cursor=db.cursor() 5 sql=‘select * from sanban‘ 6 data1=pandas.read_sql_query(sql,db) 7 print(data1)
2022-09-17 19:19:43
1 import pymysql 2 import pandas 3 db=pymysql.connect(host=‘localhost‘,port=3306,user=‘root‘,database=‘lihao‘,password=‘lh19990317‘) 4 #cursor=db.cursor() 5 sql=‘select * from sanban‘ 6 data1=pandas.read_sql_query(sql,db) 7 print(data1)