-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathhello.py
More file actions
executable file
·32 lines (27 loc) · 940 Bytes
/
hello.py
File metadata and controls
executable file
·32 lines (27 loc) · 940 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/python
# -*- coding: UTF-8 -*-
####################################################################################
# Python CGI deployment
# http://www.runoob.com/python/python-cgi.html
####################################################################################
import os
print("Content-type:text/html")
#第一行的输出内容"Content-type:text/html"发送到浏览器并告知浏览器显示的内容类型为"text/html"。
print("") # 空行,告诉服务器结束头部脚本
print('''
<html>
<head>
<meta charset="utf-8">
<title>Hello Word - 我的第一个 CGI 程序!</title>
</head>
<body>
<h2>Hello Word! 我是来自菜鸟教程的第一CGI程序</h2>
''')
print("<b>环境变量</b><br>")
print("<ul>")
for key in os.environ.keys():
print("<li><span style='color:green'>%30s </span> : %s </li>" % (key,os.environ[key]))
print("</ul>")
print('''</body>
</html>
''')