如何发送 HTTP 响应(不是请求)?

How to send HTTP response (not request)?

我需要使用 python 发送如下所示的 HTTP 响应。如何实现?

HTTP/1.1 200 OK

# set up socket and connection (socket library)
while True:
    sock, addr = servSock.accept()
    sock.send("""HTTP/1.1 200 OK
Content-Type: text/html

<html><body>Hello World</body></html>
""");
    sock.close()