Discuss / Python / 作业

作业

Topic source

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

def get_score_in(low, high):

    ' 返回指定分数区间的名字,按分数从低到高排序 '

    conn = sqlite3.connect(db_file)

    cursor = conn.cursor()

    cursor.execute('select * from user where score >=? and score<=? order by score asc', (low, high))

    values =[x[1] for x in cursor.fetchall()]

    cursor.close()

    conn.close()

    return values


  • 1

Reply