[Newbie] Strange output from list

Gilles Ganault nospam at nospam.com
Tue Nov 11 02:24:28 CET 2008


I'm getting some unwanted result when SELECTing data from an SQLite

sql = 'SELECT id FROM master'
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