[Tutor] SQLite LIKE question
Dinesh B Vadhia
dineshbvadhia at hotmail.com
Fri Apr 11 00:24:41 CEST 2008
I'm reading a text file into an in-memory pysqlite table. When I do a SELECT on the table, I get a 'u' in front of each returned row eg.
> (u'QB VII',)
> (u'Quackser Fortune Has a Cousin in the Bronx',)
I've checked the data being INSERT'ed into the table and it has no 'u'.
The second problem is that I'm using the LIKE operator to match a pattern against a string but am getting garbage results. For example, looking for the characters q='dog' in each string the SELECT statement is as follows:
for row in con.execute("SELECT <column> FROM <table> WHERE <string> LIKE '%q%' limit 25"):
print row
This doesn't work and I've tried other combinations without luck! Any thoughts on the correct syntax for the LIKE?
Dinesh
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080410/607818ab/attachment.htm
More information about the Tutor
mailing list