[Tutor] using python to write web page

Alan Gauld alan.gauld at btinternet.com
Thu Jun 16 01:25:13 CEST 2011


"Michael bridges" <micha_el2003 at yahoo.com> wrote 

>i would like to use python to write a web page like 
> writing an html file that is displayed in a browser 
> without having to run a server.

OK, So whats the problem?
Python can create html files so if you only want to 
create an html file just do it:

content = """
<html><body>
<P>Hello world</p>
</body></html>"""

open("myfile.htm","w").write(contents)

> found a few options, but need to have server running.

That depends on how you are loading the page into 
the browser. If you use FileOpen from the menu you 
can read the file as usual. If you want to access it 
over a network you either need to mount the remote 
file system or you need a web server of some sort.

Creating an html file in Python is trivial(see above)
How you access it is another mattwer entirely and 
for that we need more info.

> https://skulpt.googlecode.com/hg/skulpt
> gives 404 error

I have no idea what you are trying to tell us with 
that bit of information.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list