网站关键字优化价格,网站建设的技术路线,wordpress4.7不支持tag,wordpress添加可链接照片我尝试用python中的twisted创建一个简单的web服务器。不过#xff0c;我无法提供m4a音频文件。在在当前程序中#xff0c;当我加载http://localhost:8880/mp3.html时#xff0c;它可以正常工作。它显示音频播放器和mp3播放。此外#xff0c;程序同时打印“/mp3.html”和/测…我尝试用python中的twisted创建一个简单的web服务器。不过我无法提供m4a音频文件。在在当前程序中当我加载http://localhost:8880/mp3.html时它可以正常工作。它显示音频播放器和mp3播放。此外程序同时打印“/mp3.html”和/测试.mp3. 在但是当我加载http://localhost:8880/m4a.html时它不起作用。它显示音频播放器但m4a无法播放。此外该程序只打印“/m4a.html”而不打印“/test.m4a”。在我当前的代码如下。在import urlparseimport osfrom twisted.internet import reactorfrom twisted.web.server import Sitefrom twisted.web.resource import Resourcefrom twisted.web.static import Fileimport timeimport subprocessimport mimetypesclass playM4A(Resource):isLeaf Truedef render_GET(self, request):thisurlparse.urlparse(request.path)#scheme,netloc,path,queryroot,extos.path.splitext(this.path)filenameos.path.basename(request.path)fileFolderrequest.path.replace(filename,)self.serverRootos.getcwd()print request.pathif ext.m4a:thisFileFile(self.serverRootrequest.path)return File.render_GET(thisFile,request)elif ext.mp3:thisFileFile(self.serverRootrequest.path)return File.render_GET(thisFile,request)elif filenamem4a.html:return Your browser does not support the audio element.not m4a elif filenamemp3.html:return Your browser does not support the audio element.not m4a resource playM4A()factory Site(resource)reactor.listenTCP(8880, factory)reactor.run()