Skip to content

Instantly share code, notes, and snippets.

@masami256
Created May 4, 2013 14:13
Show Gist options
  • Select an option

  • Save masami256/5517619 to your computer and use it in GitHub Desktop.

Select an option

Save masami256/5517619 to your computer and use it in GitHub Desktop.
忘れるのでめも。pythonのhttpサーバ機能
#!/usr/bin/env python
import SimpleHTTPServer
import SocketServer
import sys
def run(port):
print "listening port is ", port
Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
httpd = SocketServer.TCPServer(("", port), Handler)
httpd.serve_forever()
if __name__ == "__main__":
port = 8000
if (len(sys.argv) == 2):
port = int(sys.argv[1])
run(port)%
[
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment