Validating Python - need doctype HTML strict

PapaRandy circa4780 at hotmail.com
Sun Jul 9 19:15:33 EDT 2006


Hello,

I am trying to validate the following .py webpage as HTML (through
W3C).

I put:

-----------------------------------------------------------------------------

print "Content-type: text/html; charset=utf-8"

import time

print

print """<html><head>

<title>Current Time</title>

</head> <body>

<h1>Current Time</h1>"""

print "<p>Right now, it is "

print "<strong>", time.asctime(), "</strong></p>"

print "</body></html>"

---------------------------------------------------

However, the .py page should also be valid (X)HTML - it needs a
doctype...

When I add the doctype, and other necessities to the .py page

(i.e., <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"" xml:lang="en" lang="en">)

I get an invalid script error.

Can anyone help me to get the XHTML doctype to validate and execute on
Python web page?

Thank you!




More information about the Python-list mailing list