多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
我们很多时候获取URL的某部分内容,而bottle在这方面能提供方便的函数给我们使用。(又是非常强悍的request对象) 下面给出代码和测试结果 ~~~ # coding:UTF-8 from bottle import Bottle, request app = Bottle() @app.get('/abc/123') def index(): return `这个地方替换成测试的变量` app.run(host="127.0.0.1", port=8000, reloader=True, debug=True) ~~~ 测试网址: http://127.0.0.1:8000/abc/123?type=qwe&action=debug#zxc | 变量名 | 输出结果 | | -- | -- | | request.fullpath | /abc/123 | | request.query_string | type=qwe&action=debug | | request.path | /abc/123 |