dynamically creating html code with python...
anartz at anartz.cjb.net
anartz at anartz.cjb.net
Mon Aug 11 09:15:45 EDT 2008
Hi,
how can I combine some dynamically generated html code (using python) with the output of a urllib.openurl() call?
I have tried to use the StringIO() class with .write functions, but it did not work. Below is the code that does not work.
[CODE]
f=StringIO.StringIO()
f.write('<html><head><title>data analysis</title></head><body>')
f.write(urllib.urlopen("http://localhost/path2Libs/myLibs.py", urllib.urlencode(TheData)))
f.write("</body></html>")
print "Content-type: text/html\n"
print f.read()
f.close()
[/CODE]
What is wrong with this approach/code? Is there an easier way of doing it?
Thanks.
More information about the Python-list
mailing list