$ python -m CGIHTTPServer 8000Serving HTTP on 0.0.0.0 port 8000 ...
$ mkdir cgi-bin/
$ vim cgi-bin/index.pyprint "Content-Type: text/html" # HTML is followingprint # blank line, end of headers
print "<TITLE>CGI script output</TITLE>"print "<H1>This is my first CGI script</H1>"print "Hello, world!"
http://localhost:8000/cgi-bin/index.py
This is my first CGI script
Hello, world!
[Python 2.7] Hello World CGI HTTP Server,布布扣,bubuko.com
[Python 2.7] Hello World CGI HTTP Server
原文:http://blog.csdn.net/wxqee/article/details/38525965