Mega Code Archive

 
Categories / Python Tutorial / CGI Web
 

Displays the current date and time in a Web browser

import time def printHeader( title ):    print """Content-type: text/html <?xml version = "1.0" encoding = "UTF-8"?>     <html xmlns = "http://www.w3.org/1999/xhtml"> <head><title>%s</title></head> <body>""" % title printHeader( "Current date and time" ) print "<paragraph>" + time.ctime( time.time() ) + "</paragraph>" print "</body></html>"