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)
解决方法很简单:
result = list(cur.fetchall())
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.