[newbie] Right way to access item in array?

Gilles Ganault nospam at nospam.com
Tue Oct 28 06:26:37 EDT 2008


Hello

I'd like to know what the right way is to access an item in a row as
returned by a database:

=====
import apsw

connection=apsw.Connection("test.sqlite")
cursor=connection.cursor()

rows=cursor.execute("SELECT isbn,price FROM books WHERE price IS
NULL")
for row in rows:

	#Is this right?
	for isbn in row:

		if isbn:
			print "Found price = " + price

connection.close(True)
=====

Thank you.



More information about the Python-list mailing list