CGI script running not completely in HTML

Christoph Haas email at christoph-haas.de
Thu Aug 17 16:06:51 EDT 2006


On Thursday 17 August 2006 21:50, Yong Wang wrote:
>     I have written a python CGI script to run in html web page. When I
> access to the html page, it only runs part of the script, then abort
> because the late part of the script is involved in database access, it
> is slow. I wonder whether there is a way to control html running speed
> so that it can wait for CGI script to complete execution, then write the
> results to html page ?

You could use

 output = ''
 output += 'Something else to print'

instead of

 print 'Something else to print'

And finally use

 print output

Or to use that more efficiently use a list of strings and append to that 
list. That's probably faster than creating another immutable string time 
and again. And finally you just ' '.join(outputlist) and print that.

Cheers
 Christoph



More information about the Python-list mailing list