import cgi
def htmlTop():
print("Content-type: text/html ")
print()
print("""<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>python 服务端测试</title>
</head>
<body>""")
def htmlTail():
print("""</body>
</html>""")
if __name__ == "__main__":
try:
htmlTop()
print("Hello World")
htmlTail()
except:
cgi.print_exception()
文件 https://pan.baidu.com/s/1gfLSXLx 是我编译的apache2.4.9 fcgid module
在win10 + apache2.4.9 + python3.5 测试成功