[Tutor] HTML Generating

Tobin, Mark Mark.Tobin@attcanada.com
Tue, 3 Jul 2001 14:49:25 -0600


OK... how come when I make a python script such as the one Sheila King
posted (below) and execute it through my local IE5.5, it executes in a
python window (DOS window) as opposed to in the browser?  I'm using PY2.1 on
a WIN95 machine with IE5.5.  I don't really know how to express this any
better (I'm just beginning to pick up some of this new language called
"programerese"), but if this isn't clear I'll try again...

Thanks in advance,

Mark

#!/usr/bin/env python

import os

print "Content-type: text/html\n\n"

print "<html>\n"

print "<Head>"
print "<Title>Obligatory Python Test Script</Title>"
print "</Head>\n"

print "<Body>\n"
print "<H3>Hello</H3>"
print "<b>This is the obligatory<br> Python 'Hello\' testscript<br></b>"
print "<i>Ta-da</i><br><br>"

print "NEW STUFF: testing environment variables<br>"
print os.environ["REMOTE_ADDR"],"<br><br>"
print "<p>And now, all the environment variables:<br>"
print "<b>",
for el in os.environ.keys():
	print el, " = ", os.environ[el], "<br>"
print "</b>"
print "THE END"

print "</body>\n</html>"