Template.cgi: Difference between revisions
No edit summary |
No edit summary |
||
Line 2: | Line 2: | ||
#!/usr/bin/python | #!/usr/bin/python | ||
== Simplified == | |||
<source lang="python"> | |||
#!/usr/bin/python | |||
print "Content-type: text/html; charset=utf8" | |||
print | |||
print "<html><head><title>My Hello World Page</title></head><body>" | |||
# do interesting stuff in Python | |||
for i in range(100): | |||
print i, " " | |||
print "</body></html>" | |||
</source> | |||
== More Complete == | |||
print "Content-type: text/html; charset=utf8" | print "Content-type: text/html; charset=utf8" | ||
print | print |
Revision as of 14:23, 9 February 2009
#!/usr/bin/python
== Simplified ==
<source lang="python">
#!/usr/bin/python
print "Content-type: text/html; charset=utf8"
print
print "<html><head><title>My Hello World Page</title></head><body>"
# do interesting stuff in Python
for i in range(100):
print i, " "
print "</body></html>"
More Complete
print "Content-type: text/html; charset=utf8" print
print """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>My Hello World Page</title> </head>
<body>
Hello World
"""
- do interesting stuff in Python
for i in range(100):
print i, " "
print """ </body> </html>
""" </source>