[ create a new paste ] login | about

Link: http://codepad.org/PPS1UXMt    [ raw code | output | fork | 1 comment ]

navarr - Python, pasted on Nov 2:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/python
class WebPage:
        title = "Page";
        def HTTPHead(c):
                print "Content-type: text/html;charset=utf-8\n";
        def SetTitle(c,title):
                WebPage.title = title;
        def HTMLHead(c):
                print "<html><head>";
                print "<title>" + WebPage.title + "</title>";
                print "</head><body>";
        def finish(c):
                print "</body></html>";

page = WebPage();
page.SetTitle("Test");
page.HTTPHead();
page.HTMLHead();
print "Hello World";
page.finish();


Output:
1
2
3
4
5
6
7
Content-type: text/html;charset=utf-8

<html><head>
<title>Test</title>
</head><body>
Hello World
</body></html>


Create a new paste based on this one


Comments:
posted by dragonsprout on Nov 3
I actually use import to include the HTML that I'm going to continuously reuse. It's kinda like PHP includes, but import also imports modules, like MySQL.
reply