Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试使用send_header('Content-Type', 'text/html'). 但是,这不起作用。
send_header('Content-Type', 'text/html')
以下在派生自的类中对我有用http.server.BaseHTTPRequestHandler:
http.server.BaseHTTPRequestHandler
self.send_response(200) self.send_header("Content-type", "text/plain") self.end_headers() # Your response body follows with self.wfile.write()
在此处和此处查看更多信息。
可能需要双引号?见例子。我希望这有帮助。