I'm using a python method to query my database as follows, where I need
to use the result set to generate some HTML. I'm interested in result[0]
and result[1] as listed below;

* return result[0] gives me:
[{'name': 'PRACTICALS', 'type': 's', 'null': None, 'width': None},
{'name': 'TUTORIALS', 'type': 's', 'null': None, 'width': None},
{'name': 'ASSIGNMENTS', 'type': 's', 'null': None, 'width': None},
{'name': 'BONUS', 'type': 's', 'null': None, 'width': None}]

* return result[1] (or just 'return result') gives me:
[(1, 16, 9, 1)]

What kind of data structure is this? First impressions suggest that it's
a tuple but why the extra brackets?. I need to access each element but
how do I do this? I've tried all sort of tuple/list
conversions/operations and have had no success.

If the result is [(1, 16, 9, 1)] how can I assign...

a=1st element i.e. 1
b=2nd element i.e 16..?

I can convert it to a string, parse it and obtain the results that way,
which is simple enough, but surely there's a way to access the element
directly? Does anyone know?



Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to