c.execute("select * from stocks")
for s in list(c):
   print s[0]
   c.execute("select * from stocks where price<20")
   for sp in c:
      print '  '+sp[0]
c.close()

The simple addition of list() should do away with the dependency on
mysql's implementation, since it forces the instant fetch of all data.
Whether that is better than to use a 2nd cursor is probably a matter
of taste.

Using "*" in selects is always bad, though. ;)
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to