G
Guest
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.
What is wrong with this approach/code? Is there an easier way of doing it?
Thanks.
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()
What is wrong with this approach/code? Is there an easier way of doing it?
Thanks.