def get_score_in(low,high):
conn = sqlite3.connect('test.db')
cursor = conn.cursor()
try:
cursor.execute('select * from user where ?<=score and score<=?', (low,high))
values = cursor.fetchall()
finally:
cursor.close()
conn.close()
#排序
values.sort(key = lambda x:x[2])
return [i[1] for i in values]
Junhong1994
看了你们的答案才知道原来还可以用'order by score'排序。