'print' in a CGI app.

Andrew Clover and-google at doxdesk.com
Mon Aug 4 00:05:07 CEST 2003


"Andrew Chalk" <achalk at XXXmagnacartasoftware.com> wrote:

> print "Hello\n"
> print "World"

> print both words on the same line in IE6.

This is because IE is treating the page as HTML by default, where
whitespace is not significant. If this is not what you want, set the
'Content-Type' HTTP header to something else, eg.:

  #!/usr/bin/python

  print 'Content-Type: text/plain; charset=utf-8'
  print

  print 'Hello'
  print 'World'

-- 
Andrew Clover
mailto:and at doxdesk.com
http://www.doxdesk.com/




More information about the Python-list mailing list