Discuss / Python / 练习

练习

Topic source
def get_score_in(low, high):
    values = []
    #' 返回指定分数区间的名字,按分数从低到高排序 '
    conn = sqlite3.connect(db_file)
    cursor = conn.cursor()
    cursor.execute('select * from user where score >= ? and score <= ? order by score asc', (low, high))
    cursorValues = cursor.fetchall()
    for i in cursorValues:
        values.append(i[1])
    cursor.close()
    conn.close()
    return values

  • 1

Reply