Thanks Ben, As you can see it's my first try at Python...or any programming for that matter.
I solved the problem of validation by adding three """ quotes after the print command and before the body, as follows: Thanks for clearing that up! ----------------------- import time #print HTTP/HTML header stuff print """Content-type: text/html; charset=utf-8\n\n <!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> """ print #print HTML body using Python-HTML hybrid script print "<h1>Current Time</h1>" print "<p>Right now, it is " print "<strong>", time.asctime(), "</strong></p>" print """<p> <a href="http://validator.w3.org/check?uri=referer"><img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0 Strict" height="31" width="88" /></a> </p> """ print "</body></html>" Ben Sizer wrote: > PapaRandy wrote: > > > 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. > > Bear in mind, that this isn't 'a webpage', it's a computer program that > creates a webpage. So you're not 'adding a doctype', you're 'adding > some code to output a doctype', and similarly it's not Python you're > validating, it's the output it creates that you validate. These are > important distinctions. > > Anyway, what is the exact line of code you use to 'add the doctype'? > And what is this 'invalid script error'? It's hard to debug your code > when we have to guess what it is! However, because I'm in a good mood, > I'll have a go. > > You probably need to escape the double quotes in the doctype because > they unintentionally correspond with the double quotes in your print > statement. The print statement uses double quotes to delimit the > output, and the doctype uses them to delimit the type. Unfortunately > the print statement probably interprets the start of the doctype's type > field as the end of the print statement. Add a backslash before each > double quote within your doctype and see how that goes. Alternatively > you could possibly use single quotes in it instead. > > -- > Ben Sizer -- http://mail.python.org/mailman/listinfo/python-list