import pandas as pd import pymysql conn = pymysql.connect(user="root", password="cyh0110", database="stu_sys", host="127.0.0.1", port=3306) data_frame = pd.read_sql("select * from student limit 10", conn) print(data_frame.keys().tolist()) for row in data_frame.itertuples(): print([row[i] for i in range(1, len(row))])