when i run server i got "name 'http' is not defined" after import http.server then i got this "no mo

来源:互联网 发布:阿里云幕布原图下载 编辑:程序博客网 时间:2024/05/23 14:40

http.server only exists in Python 3. In Python 2, you should use theBaseHTTPServer module:

from BaseHTTPServer import BaseHTTPRequestHandler

should work just fine.

so if you run in py3 is ok

在Python 3.x中,BaseHTTPServer, SimpleHTTPServer, CGIHTTPServer整合到http.server包,SocketServer改名为socketserver,请注意查阅官方文档。


0 0
原创粉丝点击