Discuss / Python / 交作业啦

交作业啦

Topic source

def get_score_in(low, high):

    try:

        conn = sqlite3.connect('test.db')

        cursor = conn.cursor()

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

        values = cursor.fetchall()

    except Exception as e:

        print('Error:'.e)

    finally:

        cursor.close()

        conn.close()

    l=list(name[0] for name in values)

    return l


  • 1

Reply