in CGI, how to include html pages?

Andrew Chalk achalk at XXXmagnacartasoftware.com
Sat Sep 6 18:20:34 EDT 2003


How about:

htmlHeader = '''<html>

<head>

<meta http-equiv="Content-Language" content="en-us">

<meta name="GENERATOR" content="Microsoft FrontPage 5.0">

<meta name="ProgId" content="FrontPage.Editor.Document">

<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">

<title>New Process</title>

</head>'''

print htmlHeader


"Nick Welch" <mack at incise.org> wrote in message
news:mailman.1062860351.26409.python-list at python.org...
> 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.
> >
> > -- 
> > http://mail.python.org/mailman/listinfo/python-list
>
> f = file("header.html")
>
> for line in file:
>   print line,
>
> f.close()
>
> And of course you could easily write a function to wrap this so you
> could just include("header.html").
>
> HTH,
> -- 
> Nick Welch aka mackstann | mack @ incise.org | http://incise.org
> If you have a procedure with 10 parameters, you probably missed some.
>






More information about the Python-list mailing list