Outputting strings in html

Mikkel Rasmussen footech at get2net.dk
Tue Dec 3 16:22:20 EST 2002


How about this?

color = "#FFFF00"
print """
<html><head><title>hello</title></head>
<body bgcolor=""" + color + """>
.....
"""

Cheers
Mikkel Rasmussen
http://hjem.get2net.dk/footech


Ben <me at here.nerd> wrote in message
news:pan.2002.12.03.18.15.48.122448 at here.nerd...
> Hey all,
> i'm very new to python programming (impressed so far - i love the way it
> handles cgi forms - WAY better than C :), but i'm a bit confused on one
> or two things....
>
> variables, unlike C aren't declared with types, right?  so doing
> color = "#FFFF00" would give me a string FFFF00....but how can i use
> that if i'm writting html in a script?
> i want to do something like this:
>
> print """
> <html><head><title>hello</title></head>
> <body bgcolor=color>
> .....
> """
> but I can't get the string to be displayed?
> i've tried bgcolor="+color+", and searched google for "python """ print
> variable", but haven't found anything of use yet.
> any help for a noob?
>
> thanks.





More information about the Python-list mailing list