gvim time.py
#!/usr/bin/env python
# -*- coding utf8 -*-
import cgitb
cgitb.enable()
import time
print "Content-type: text/html"
print
print time.strftime('%Y-%m-%d %X', time.localtime() )
form = cgi.FieldStorage()
# Get data from field 'name'
name = form.getvalue('name')
cgi 服务器建立# -*- coding utf8 -*-
import cgitb
cgitb.enable()
import time
print "Content-type: text/html"
print time.strftime('%Y-%m-%d %X', time.localtime() )
form = cgi.FieldStorage()
# Get data from field 'name'
name = form.getvalue('name')
cd cgi
python -m CGIHTTPServer
到 firefox 中
http://127.0.0.1:8000/cgi-bin/time.py
本文转自博客园刘凯毅的博客,原文链接:python 最简单的 cgi webserver,如需转载请自行联系原博主。