Using python in CGI

Thomas Guettler pan-newsreader at thomas-guettler.de
Sun Feb 23 10:11:02 EST 2003


On Sun, 23 Feb 2003 14:40:32 +0100, p.s wrote:

> Hi there,
> i'm trying to port my uni assignment from C to python, but having a few
> problems figuring out some things.
> Firstly, file i/o.
> I want something similar to this pseudo code:
> 
> open file
> while not at eof
> 	read first line
> 	if firstchar on line is not "#"
> 		print line
> 	else
> 		go onto next line

fd=open(file)
for line in fd.readlines():
    if line[0]!="#":
        print line

> I'm also interested in any information about directly outputting text
> from a file, onto the page(web browser).  Both raw( with "\n" and "\t"
> etc), and ascii (just a-z, A-Z, and 0-9).

If you want to dynamically create html you need some http server.
You can install apache and write a script which creates http responses.

You should find some examples with google.

 thomas

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




More information about the Python-list mailing list