def get_score_in(low, high): ' 返回指定分数区间的名字,按分数从低到高排序 ' try: conn = sqlite3.connect(db_file) cursor = conn.cursor() cursor.execute('select * from user where score > ? and score <= ?', (low, high)) l = sorted(cursor.fetchall(), key=lambda x: x[2], reverse=False) finally: cursor.close() conn.close() return list(n[1] for n in l)
Sign in to make a reply
用户5738776098