how to remove u from sqlite3 cursor.fetchall() in python

Viewed 23558
import sqlite3
class class1:
def __init__(self):
    self.print1()
def print1(self):
    con = sqlite3.connect('mydb.sqlite')
    cur = con.cursor()
    cur.execute("select fname from tblsample1 order by fname")
    ar=cur.fetchall()
    print(ar)

class1()

gives an output as shown below

[(u'arun',), (u'kiran',), (u'kulku',), (u'sugu',)]

i need to remove u from the array and i need output as shown below

['arun', 'kiran', 'kulku', 'sugu']
4 Answers

I just add this line and it works

conn.text_factory = str
Related