in CGI, how to include html pages?

Nick Welch mack at
Sat Sep 6 16:58:39 CEST 2003

On Sat, Sep 06, 2003 at 11:05:44AM -0400, python wrote:
> Hi-
> I'm writing some CGI stuff and I'm doing it in python to force myself to
> learn the language.  Anyway,  I want to include some html at the top of
> every page but I'm not sure how.
> If the header is in header.html, what is the python-ese way of printing
> that out in my html?
> Thanks for the help.
> -- 

f = file("header.html")

for line in file:
  print line,


And of course you could easily write a function to wrap this so you
could just include("header.html").

Nick Welch aka mackstann | mack @ |
If you have a procedure with 10 parameters, you probably missed some.

More information about the Python-list mailing list