[Tutor] cgi scripts

Jim Morcombe jmorcombe at westnet.com.au
Sat Nov 8 09:38:31 CET 2008

Thanks guys,

This works :)

field_list = '<ul>\n'
for field in data.keys():
    field_list = field_list + '<li>%s : %s</li>\n' % (field, 
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.


Alan Gauld wrote:
> "Jim Morcombe" <jmorcombe at westnet.com.au> 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,

More information about the Tutor mailing list