5、用python写一个自己的网页

1、新建一个文件夹 ,在里面新建一个文件cgi–bin的文件

2、插入代码;

print ("Content-type:text/html")
print ()
print ('<html>')
print ('<head>')
print ('<meta charset="gb2312">')
print ('<title>Hello Word- 我的第一个 CGI 程序!</title>')
print ('</head>')
print ('<body>')
print ('<h2>Hello Word! 123456</h2>')
print ('</body>')
print ('</html>')

3、在cmd按顺序写下如下代码:

4、然后在电脑网页输入如下链接:http://localhost:8081/cgi-bin/111.py

结果如下:

哈哈完成啦,耶

猜你喜欢

转载自www.cnblogs.com/LuDuo/p/10810222.html