Import Socket DEF servece_client (Since the software of): "" " for the data returned to the client " "" # request sent from a browser to the receiver, i.e., an http request # the GET / the HTTP / 1.1 # ... Request = new_socket.recv (1024 ) Print (Request) # 2 returns the http data to the browser # 2.1 prepares the data sent to the browser of the browser header --- Response = " the hTTP / 1.1 200 is the OK \ R & lt \ n- " Response + = " \ R & lt \ the n- " # number 2.1 is ready to send to the browser browser body --- the Response + = " <h1> ha </ h1> " Since the software of.send(response.encode(" UTF-. 8 " )) # close the socket new_socket.close () DEF main (): "" " is used to complete the overall control " "" # 1 Create a socket tcp_server_socket = socket.socket (socket.AF_INET, socket.SOCK_STREAM) # 2 binding tcp_server_socket.bind (( "" , 7890 )) # 3 becomes the listening socket tcp_server_socket.listen (128 ) the while True: # 4 waiting for a new client links Since the software of, client_addr = tcp_server_socket.accept () # 5 for the client service servece_client (Since the software of) # close the socket tcp_server_socket.close () IF __name__ == " __main__ " : main ()