How to shut down python server
问题 Used this code to run a python server: import os from http.server import SimpleHTTPRequestHandler, HTTPServer os.chdir('c:/users/owner/desktop/tom/tomsEnyo2.5-May27') server_address = ('', 8000) httpd = HTTPServer(server_address, SimpleHTTPRequestHandler) httpd.serve_forever() How to make it stop? 回答1: Your question is ambiguous - if your running the server via shell i.e. python myscript.py, simply press crtl + C . If you want to close it elegantly using code, you must decide on some