Re: [Tutor] encode unicode strings from pysqlite

2008-04-14 Thread Dinesh B Vadhia
tly! - Original Message - From: Kent Johnson To: Dinesh B Vadhia Cc: tutor@python.org Sent: Monday, April 14, 2008 3:42 AM Subject: Re: [Tutor] encode unicode strings from pysqlite Dinesh B Vadhia wrote: > Here is a program that SELECT's from a pysqlite database table

Re: [Tutor] encode unicode strings from pysqlite

2008-04-14 Thread Kent Johnson
Dinesh B Vadhia wrote: > Here is a program that SELECT's from a pysqlite database table and > encode's the returned unicode strings: > query = "SELECT fieldB FROM testDB WHERE fieldB LIKE '%s' LIMIT '%s'" > %(q, limit) > for row in cur.execute(query): Here row is a list containing a single unic

[Tutor] encode unicode strings from pysqlite

2008-04-14 Thread Dinesh B Vadhia
Here is a program that SELECT's from a pysqlite database table and encode's the returned unicode strings: import sys import os import sqlite3 con = sqlite3.connect("testDB.db") cur = con.cursor() a = u'99 Cycling Swords' b = a.encode('utf-8') print b q = '%wor%' limit = 25 query = "SELECT fiel