gordnjen wrote: > So, now I need to know how to insert a doctype declaration into my > python script so that a) the python script runs properly and b)the page > validates as valid XHTML. > > Here is my code below. It runs fine as a python script, but won't validate: > > import time > print "Content-type: text/html" > print
print '<?xml version="1.0" encoding="UTF-8"?>' print '''<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">''' print '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">' > print "<head>" > print "<title>Current Time</title>" > print "</head><body>" > print "<h1><b>Current Time</b></h1>" > print "<p>The current time is" > print "<strong>", time.asctime(), "</strong></p>" > print "</body></html>" By the way, triple-quoted strings are very handy for this, you can just say print '''<?xml version="1.0" encoding="UTF-8"?> <!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"> <head> <title>Current Time</title> </head><body> <h1><b>Current Time</b></h1> <p>The current time is''' Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor