[Newbie] Strange output from list
Gilles Ganault
nospam at nospam.com
Mon Nov 10 20:24:28 EST 2008
Hello
I'm getting some unwanted result when SELECTing data from an SQLite
database:
======
sql = 'SELECT id FROM master'
rows=list(cursor.execute(sql))
for id in rows:
sql = 'SELECT COUNT(code) FROM companies WHERE code="%s"' % id[0]
result = list(cursor.execute(sql))
print "Code=%s, number=%s" % (id[0],result[0])
======
Code=0111Z, number=(47,)
======
I expected to see "number=47". Why does Python return "(47,)"?
Thank you.
More information about the Python-list
mailing list