A couple of Python CGI questions

sean sean_berry at cox.net
Tue Mar 30 01:15:37 EST 2004


I tried getting mod_python to work but have had lots of problems getting it
running.  So, I have settled on using python cgi.

I have already got it going and it seems to run fast enough for me.

My questions are:
1.  Is there any way to access variables from within a string like perl cgi?
I have found that the best way for me to write html tables is to use a print
"""<blah blah blah>""" string.  That way I can write one print """, and then
write html as if I were writing an html file.  For example:
print """
<table border="0" cellspacing="0">
<tr>
    <td>This is cool</td>
</tr>
</table>
"""
I really like this and it is a lot like typing the following in Perl cgi:
print <<EOF
<table border="0" cellspacing="0">
<tr>
    <td>This is cool</td>
</tr>
</table>
EOF

So, is there any way to access variables from within the string, besides
using %s?  In perl, I just put the $variable in the string and it replaces
the varname with the value.

2.  Is there a good online resourse for pyton cgi?
3.  How do you collect request variables from forms sent to the python cgi
page, whether post or get?


Thanks very much for the help... I will continue to google for my answers.

Sean






More information about the Python-list mailing list