Note that there are some explanatory texts on larger screens.

plurals
  1. POhow to delete the "u and ' ' " before the of database table display by python
    primarykey
    data
    text
    <p>I am trying to use python to create a database and then insert data and display it. However, the output adds a <code>u</code> before every string. What should I do, how can I delete the "u"? the following is the output display:</p> <pre><code>----------------------------------------------- | 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') </code></pre> <p>I want the output only shows like</p> <pre><code>----------------------------------------------- | Date | Time | Price | ----------------------------------------------- 31/05/2013 11:10 $487 </code></pre> <p>I do not want to see the <code>u</code> and the <code>''</code>.</p> <p>the following is a part of my code</p> <pre><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 </code></pre> <p>so, could anyone can help me figure out how to delete the <code>g</code> and <code>''</code></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload