[Tutor] Reading and outputting HTML
Sharriff Aina
NHYTRO@compuserve.com
Mon, 5 Feb 2001 02:55:45 -0500
Sorry for taking so long to post my script. Below is the code I used,
please excuse its " roughness", I=B4m a 3 Weel old newbie:
#!C:/Python/python.exe -u
print "Content-Type: text/html\n\n"
import cgi
import webbrowser
#
#
form =3D cgi.FieldStorage()
print "saving html to file..."
htmlfile =3D open("./webpages/tester.html", "w")
htmlfile.write(form["editarea"].value)
test =3D htmlfile.read()
print "test file output..."
print test
webbrowser.open("./webpages/tester.html")
I would like to display the generated HTML , but the page Displays garble=
d
on the SERVER!!?? I just can=B4t get my code to edit, store and re-displa=
y
HTML files :-(
Thanks for your anticipated help!
Sharriff
Message text written by INTERNET:tutor@python.org
>* Sharriff Aina <NHYTRO@compuserve.com>:
> I have coded a CGI script that creates HTML files, strange thing is, wh=
en
> reading a HTML file, one created by the script or otherwise, I just get=
a
> very garbled page returned to the browser. =
You seem to be saying above that your browser is broken ("created by the
script or otherwise..."). Could you clarify you message? Also posting
example code and errors helps greatly.<