'print' in a CGI app.
Irmen de Jong
irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Sun Aug 3 15:03:27 EDT 2003
Andrew Chalk wrote:
> In a Python 2.2 app. running under CGI the statements
>
> print "Hello\n"
> print "World"
>
> print both words on the same line in IE6. How do I print the second one on a
> new line (i.e. respect the \n in the first statement).
Umm. This has nothing to do with Python... but hey :-)
Unless your CGI script is set to content-type: text/plain,
you're supposed to print valid HTML.
You'll have more success if you print the following:
print "<html><body>" # begin HTML
print "<pre>" # HTML 'preformatted' block
print "Hello\n"
print "World"
print "</pre>" # end 'preformatted block'
print "</body></html>" # end HTML
--Irmen
More information about the Python-list
mailing list