Reputation: 1
import sqlite3
#connect to the sqlite database
conn = sqlite3.connect('database.db')
#create a cursor
c = conn.cursor()
#select query to return a single row
c.execute('SELECT NAME FROM T1')
#row contains the returned result
row = c.fetchone()
#print the result
print(row)
It prints something like --> (u'John',)
, but I only want John
Upvotes: 0
Views: 1034
Reputation: 1124818
You are printing the whole row, which is always going to be a tuple.
If you wanted to print just the first column, use subscription:
print(row[0])
Upvotes: 3