Using python for CGI output...

Ben me at anon.org
Tue Dec 10 13:17:54 EST 2002


Hi,
i have a site which was written in C, and now i'm learning python so i can
rewrite it...
i've written a bit of code (below), and the output only shows the print
statement from my defined function, rather than including that output from
where it was called.
How can i get this code to output it's html, along with the output of any
functions that are called along the way?

thanks for reading!

-----------------------------
#!/usr/bin/python
print "Content-type: text/html\n\n"

#set some page attributes
bgc ="#A8ACBA"

def helloWorld():
        print "Hello there world!"

print """
<html>
<head><title>:welcome:</title></head>
<body bgcolor="""+bgc+""">
        function:
        """+helloWorld()+"""
</body>
</html>

"""




More information about the Python-list mailing list