[ale] Pyhon syntax

John P. Healey jpheale at LearnLink.Emory.Edu
Tue Jan 25 16:08:04 EST 2005


how much data are you dealing with?  if you fetch all of the rows at once, you
can iterate through them with automatic tuple unpacking:

query = "SELECT id, name, value FROM my_table"
cursor.execute(query)
rows = cursor.fetchall()
for id, name, value in rows:
	print "%s(%s): %s" % (id, name, cursor)

it's not the best solution if you're dealing with tons of data, but it is
extremely readable.

5265762e204a6f686e6e79204865616c6579



More information about the Ale mailing list