writing html code

Thomas Guettler pan-newsreader at thomas-guettler.de
Thu Mar 6 01:52:46 EST 2003


On Wed, 05 Mar 2003 23:37:50 +0100, Ali Dada wrote:

> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
> <HTML><HEAD>

Please don't post HTML, use plain text!

> I am new to
> python and i have a couple of small questions, let's start with the
> first for now: i want to write a script that launch a web browser and
> writes in in some text. so basically what is the command open the
> browser in write mode and what is the command that permits us to write
> html code into the opened brower? is the latter something like

It's very difficult to let the user write html, but it is very easy
to create html file and open it in a browser (read-only):

import webbrowser

htmlfile="foo.html"
fd=open(htmlfile, "w")
fd.write("<html>foo</html>")
fd.close()
webbrowser.open(htmlfile)

 thomas

-- 
Thomas Guettler <guettli at thomas-guettler.de>
http://www.thomas-guettler.de




More information about the Python-list mailing list