import pymysql db= pymysql.connect(host="", user=‘‘, database="", password=‘‘) cursor = db.cursor(cursor=pymysql.cursors.DictCursor) cursor.execute("SELECT order_no FROM table limit 10") order_stat= cursor.fetchall() print(order_stat) cursor.close() db.close() ‘‘‘ ###简写 cursor = pymysql.connect(host="", user=‘‘, database="", password=‘‘, cursorclass=pymysql.cursors.DictCursor).cursor() cursor.execute("SELECT order_no FROM table limit 10") # order_stat = cursor.fetchall() order_stat = cursor.fetchone() print(order_stat) cursor.close() ‘‘‘