sqlite3 adaptors mystery

Mel mwilson at the-wire.com
Sun Mar 2 00:41:42 CET 2008


Matej Cepl wrote:
[ ... ]
> However, when running this program it seems converter doesn’t seem to work,
> because I get:
> 
> [matej at viklef dumpBugzilla]$ rm test.db ; python testAdaptors.py
> [(u'False',), (u'True',)]
> [matej at viklef dumpBugzilla]$
> 
> There is probably something quite obvious what I do incorrectly, but I just
> don't see it. Could somebody kick me in the right direction, please?

There's nothing much wrong.  cur.fetchall is returning a list of all 
the selected rows, and each row is a tuple of fields.  Each tuple is 
being converted for display by repr, so the strings are shown as 
unicode, which is what they are internally.  Change the print to

for (field,) in cur.fetchall():
     print field

and you'll see your plain-text strings.

	Mel.



More information about the Python-list mailing list