[DB-SIG] a little help please
D'Arcy J.M. Cain
darcy@druid.net
Thu, 9 Mar 2000 03:30:47 -0500 (EST)
I assume this is PyGreSQL, right? Note that this is not DB-SIG compliant
(yet) and probably belongs better on the PyGreSQL mailing list which you
can subscribe to at http://www.vex.net/mailman/listinfo/pygresql/.
Thus spake Garrett Gradisar
> print r # the fields are in order here
>
> print r.dictresult()
> #when I do this the fields are no longer in the currect order
That's right. The dictresult() method returns a list of dictionaries
which are not ordered. The idea is to use the value like this:
for row in r.dictresult():
print """Name: %(name)s, Address: %(address)s""" % row
If you want it ordered, use getresult() instead.
> I need them in the correct order so I can print them in an html table.
I do this all the time with dictresult(). See http://www.druid.net/rides/
for a more complete example. The link at the bottom allows you to view
the Python that generated the page.
--
D'Arcy J.M. Cain <darcy@{druid|vex}.net> | Democracy is three wolves
http://www.druid.net/darcy/ | and a sheep voting on
+1 416 425 1212 (DoD#0082) (eNTP) | what's for dinner.