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

结果如下:

 

哈哈完成啦,耶


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM