so trying run simple query in python using sqlite try out . result of query right, "u" @ beginning of each text field , not sure why. here code:
import sqlite3  db = sqlite3.connect(':memory:') c = db.cursor()  c.execute("create table students (id integer primary key autoincrement, fn text, ln text);")  c.execute("insert students (fn,ln) values ('firstname','lastname');")  c.execute("select * students")  in c:     print(i)   and here result get:
(1, u'firstname', u'lastname')  process finished exit code 0   any clue why happens ?
in python source code, unicode literals written strings prefixed u or u character.
if don't want word became unicode can encode unicode-escape:
>>> s.encode('unicode-escape') 'firstname'      
Comments
Post a Comment