Hi all, I wrote this code as an example from a book:
#!c:\Python26\python.exe # Program displaying CGI environment variables. import os import cgi def printHeader(title): print """Content-type: text/html <?xml version = "1.0" encoding = "UTF-8"?> <! DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>%s</title></head> <body>""" % title rowNumber = 0 backgroundColour = "white" printHeader("Environmental Variables") print """<table style = "border: 0">""" # print table of cgi variables and values for item in os.environ.keys(): rowNumber += 1 if rowNumber % 2 == 0: # even row numbers are white backgroundColour = "white" else: # odd row numbers are grey backgroundColour = "lightgrey" print """<tr style = "background-color: %s"> <td>%s</td><td>%s</td</tr>""" %(backgroundColour, cgi.escape(item), cgi.escape(os.environ[item])) print """</table></body></html>""" It was supposed to return a list of environmental variables in a given order. Sadly only the header displayed. I have looked through over and over, please what am i doing wrong. This is from Deitel How to program python, Chapter 6. thanks and best regards. -- Elegbede Muhammed Oladipupo OCA +2348077682428 +2347042171716 www.dudupay.com Mobile Banking Solutions | Transaction Processing | Enterprise Application Development
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor