#! C:\Programmer\python\pythonw.exe

import re
folder = "C:\\Programmer\\python\\cgi-bin\\"
file = "template.html"

Template = open(folder+file, "r")
TemplateRead = Template.read()
Template.close()

title = "Hello World!"
content = "<center><h1>Hello CGI-World!</h1></center>"
try:
    output = re.sub("REPLACE_TITLE", title, TemplateRead)
    output = re.sub("<!--REPLACE_CONTENT-->", content, output)
except:
    print "ERROR"

print output

