擅长:python、mysql、java
<p>使用<code>HTTPServer</code>来提供内容不是一个好主意。您应该使用像Apache这样的web服务器,并将Python用作CGI(或更高级的接口,如<code>mod_wsgi</code>)。在</p>
<p>然后,web服务器在一个端口上运行,您可以直接在web服务器上运行HTML,并在Python中编写任意数量的CGI脚本,例如使用<code>CGIXMLRPCRequestHandler</code>为XMLRPC请求编写的CGI脚本。在</p>
<pre><code>class MyFuncs:
def div(self, x, y) : return x // y
handler = CGIXMLRPCRequestHandler()
handler.register_function(pow)
handler.register_function(lambda x,y: x+y, 'add')
handler.register_introspection_functions()
handler.register_instance(MyFuncs())
handler.handle_request()
</code></pre>