CGI Script using Python

Simon Faulkner News at Titanic.co.uk
Tue Jan 4 09:14:23 EST 2000


Just for my info,

why?

>>
>>     print "Content-type: text/html\n"
>>     print "<H3>"
>>     print "TITLE"
>>     print "</H3>"

works OK for me.

is it flawed? (I know it's not perfect :-)

Simon




On Mon, 3 Jan 2000 19:25:28 -0500, Jeff <jam at quark.emich.edu> wrote:

>On Tue, Jan 04, 2000 at 12:20:51AM +0000, Paul E. Bible wrote:
>> Hi there,
>> 
>> I'm currently developing a CGI script using Python under Apache Web Server.
>> I've written a simple script, placed it in the /cgi-bin subdirectory and
>> perform a chmod 755 on it.  Here is the script:
>> 
>> -----------------------------------------------------------
>> #!/usr/local/bin/python
>> import os, string, sys
>> from cgi import *
>> 
>> def Main():
>>     print "Content-type: text/html\n\n"
>>     print "<HTML>"
>>     print "<HEAD>"
>>     print "This is a test"
>>     print "</HEAD>"
>>     print "<BODY></BODY>"
>>     print "</HTML>"
>>     sys.exit(0)
>> 
>> Main()
>
>change the above to:
>
>print "Content-Type: text/html"
>print
>print "<HTML>"
># continue with the rest of the script. notice extra 'print' above
>
>hope that helps.
>
>regards,
>J

Simon Faulkner



More information about the Python-list mailing list