-1

This one outputs tuple, but I want it to convert to array so I can access each element in the array to my main function. here is the code:

def numbers():
    db = getDB();
    cur = db.cursor()
    sql = "SELECT mobile_number FROM names"
    cur.execute(sql)
    result = cur.fetchall()

    for [x] in result:
        print(x)

1 Answers1

0

The solution is very simple:

result = list(cur.fetchall())
Riccardo Bucco
  • 13,980
  • 4
  • 22
  • 50