FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


A Simple Python Dynamic Page





deepak
Hello friends,

I saw some fanastic people about python as web application. Here is a example to use Python as CGI

lizzie.py?data=param
Code:

#!/usr/bin/python
print "Content-Type: text/html\n\n"
import cgi form = cgi.FieldStorage()
strBlah = form["data"].value
print """ Lizzie Loves %s  """ % strBlah.replace( '"', '\\"')


just copy and paste this code, put it in your cgi-bin change appropiate permission.CHANGE CHMOD 777(if you dont know about CHMOD).

Happy Python Programming
Antoine_935
it should be
Content-Type: text/html\r\n
\r\n

the first \r\n is single's header end, the second is all headers's end
eznet
I can get simple python scripts running via CGI but am having troubles with slightly more complex scripts (although still basic).

To avoid poor posting etiquette (although I am not sure this does it Laughing ) I will direct you to my previous post - the code and question are the 2nd post under this thread.

Thanks for any help in advance!
deepak
Antoine_935 wrote:
it should be
Content-Type: text/html\r\n
\r\n

the first \r\n is single's header end, the second is all headers's end


Antoine \r\n is endline for window machines .. \n also works fine with all POSIX OS.

eznet check out your topic, I've solved your problem Very Happy
Related topics
Can someone design me simple HTML template? or some images..
Writing in HTML
Simple python
Install a Simple Machines Forum (SMF)
Starting out with Python
which ftp program do u use?
HTML
Feedback: www.pureimpressions.com.au
Google and Domains: help
My site
Why are you using FRIhost
PHP and SEO
Static Webpage not showing Pictures properly
Fantasy PC Community *5000 Articles*10 Members A Day*
Reply to topic    Frihost Forum Index -> Scripting -> Others

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.