[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ale] Pyhon syntax



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