def get_score_in(low, high): conn = sqlite3.connect("score.db") cursor = conn.cursor() cursor.execute("select * from user where ? <= score and score <= ?", (low, high))#这里不能这么写:where ? <= score <= ? values = cursor.fetchall() cursor.close() conn.close() return [i[1] for i in sorted(values, key = lambda x : x[2])]
Sign in to make a reply
花朝zhe
def get_score_in(low, high): conn = sqlite3.connect("score.db") cursor = conn.cursor() cursor.execute("select * from user where ? <= score and score <= ?", (low, high))#这里不能这么写:where ? <= score <= ? values = cursor.fetchall() cursor.close() conn.close() return [i[1] for i in sorted(values, key = lambda x : x[2])]