Discuss / Python / 交作业

交作业

Topic source

花朝zhe

#1 Created at ... [Delete] [Delete and Lock User]

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])]


  • 1

Reply