python创建一个最简单http webserver服务器的方法,pythonwebserver
python创建一个最简单http webserver服务器的方法,pythonwebserver
本文实例讲述了python创建一个最简单http webserver服务器的方法。分享给大家供大家参考。具体实现方法如下:
import sys import BaseHTTPServer from SimpleHTTPServer import SimpleHTTPRequestHandler Handler = SimpleHTTPRequestHandler Server = BaseHTTPServer.HTTPServer Protocol = "HTTP/1.0" if sys.argv[1:]: port = int(sys.argv[1]) else: port = 8000 server_address = ('127.0.0.1', port) Handler.protocol_version = Protocol httpd = Server(server_address, Handler) print("Serving HTTP") httpd.serve_forever()
希望本文所述对大家的Python程序设计有所帮助。
相关内容
- python从sqlite读取并显示数据的方法,pythonsqlite
- python写入xml文件的方法,python写入xml
- python实现连接mongodb的方法,python实现mongodb
- python使用pil生成图片验证码的方法,
- python实现类的静态变量用法实例,python静态
- 在Windows服务器下用Apache和mod_wsgi配置Python应用的教程,
- 编写Python脚本批量下载DesktopNexus壁纸的教程,pythondes
- python实现逆波兰计算表达式实例详解,python波兰
- python通过post提交数据的方法,pythonpost提交数据
- 在Python中使用全局日志时需要注意的问题,python全局
评论关闭