Thanks guys,

This works :)

field_list = '<ul>\n'
for field in data.keys():
field_list = field_list + '<li>%s : %s</li>\n' % (field, data[field].value)
field_list = field_list + '</ul>\n'
print field_list

I think the problem wasn't in getting the keys and values, but I might have been producing illegal HTML code before.
I think I'd better brush up on my HTML skills.

Jim





Alan Gauld wrote:

"Jim Morcombe" <[EMAIL PROTECTED]> wrote

The code I sent before had a silly mistake in it. Here is a better example of the things I am trying and failing at.

Look at what you are doing in the two examples....

# This next bit also works and I can see the value of the variable print "<B>JQuiz_q01_score = ", data["JQuiz_q01_score"].value

# However, whenever I try to iterate over all the keys, I get the print "<BR>"data[k].key

Can you see what you are doing differently whwen accessing
the data?

HTH,




_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to