fetchall() „fetches all „rows“ in one step:
import sys
import MySQLdb
c = MySQLdb.connect(host = "localhost",
user = "testuser",
passwd = "testpass",
db = "test")
cursor = c.cursor()
cursor.execute("SELECT name,category FROM animal")
rows = cursor.fetchall()
for row in rows:
print "%s, %s" % (row[0], row[1])
print "Number of rows returned: %d" % cursor.rowcount