I am trying to use python to create a database and then insert data and display it.
However, the output adds a u
before every string.
What should I do, how can I delete the "u"?
the following is the output display:
-----------------------------------------------
| Date | Time | Price |
-----------------------------------------------
(u'31/05/2013', u'11:10', u'$487')
(u'31/05/2013', u'11:11', u'$487')
(u'31/05/2013', u'11:13', u'$487')
(u'31/05/2013', u'11:19', u'$487')
I want the output only shows like
-----------------------------------------------
| Date | Time | Price |
-----------------------------------------------31/05/2013 11:10 $487
I do not want to see the u
and the ''
.
the following is a part of my code
cursor.execute("CREATE TABLE if not exists table2 (date text, time text, price real)")date=strftime("%d/%m/%Y")
time=strftime("%H:%M")
data1 = [(date,time,eachprice),]
cursor.executemany('INSERT INTO table2 VALUES (?,?,?)', data1)
conn.commit()
#output
print "Showing history for 'ipad mini', from harveynorman"
print "-----------------------------------------------"
print "| Date | Time | Price |"
print "-----------------------------------------------"
for row in cursor.execute('select * from table2').fetchall():print row
so, could anyone can help me figure out how to delete the g
and ''