mercredi 27 avril 2016

How to get rid of brackets when selecting data from SQL table (Python)?

def check_gen0_1(db_name):
    with sqlite3.connect(db_name) as db:
    cursor = db.cursor()
    cursor.execute("select JuvPop from History where Generation=0")
    global results1
    results1 = cursor.fetchone() 

def check_gen0_run(db_name):
    if __name__ == "__main__":
    check_gen0_1(db_name)

def menu2(dbless, db_name):
    check_gen0_run(db_name)
        print(results1)

This is my code. The result printed is

(0,)

How do I get rid of the brackets? How do I only get the 0 or whatever value is there.

Aucun commentaire:

Enregistrer un commentaire