G
Gobo Borz
Hi everyone,
I have a python cgi program that uses print statements to write html.
The program has grown, and for reasons I won't bore you with, I need to
build the page in a string and "print" it at once.
I remember reading somewhere that building the string with successive
"+=" statements is inefficient, but I don't know any alternatives, and
my search attempts came up empty. Is there a better, more efficient way
to do it than this:
#---------------------------------
htmlPage = "<html><header></header><body>"
htmlPage += "more html"
....
htmlPage += "even more html"
....
htmlPage += "</body></html>"
print htmlPage
#-------------------------------------
Thanks, Gobo
I have a python cgi program that uses print statements to write html.
The program has grown, and for reasons I won't bore you with, I need to
build the page in a string and "print" it at once.
I remember reading somewhere that building the string with successive
"+=" statements is inefficient, but I don't know any alternatives, and
my search attempts came up empty. Is there a better, more efficient way
to do it than this:
#---------------------------------
htmlPage = "<html><header></header><body>"
htmlPage += "more html"
....
htmlPage += "even more html"
....
htmlPage += "</body></html>"
print htmlPage
#-------------------------------------
Thanks, Gobo