【发布时间】:2019-01-17 01:41:57
【问题描述】:
网址:http://127.0.0.1:5000/login?apple=exec&basket=app
Apple 值返回为 exec,但篮子值返回为 None 而不是 app。获取第二个值的问题
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/login', methods=['GET'])
def login():
a = str(request.args.get('apple', type = str))
b = str(request.args.get('basket', type = str))
return (b)
if __name__ == "__main__":
app.run()
【问题讨论】:
-
你运行的是什么版本的python,什么版本的Flask?
-
Flask 1.0.2 Python 3.4.8
-
如果您将
b请求更改为:b = request.args.get('basket', 'value'),会发生什么?是否输出value? -
它以 value 作为默认值,它返回 execvalue 而不是 execNone
-
卸载不起作用,是的,肯定会查看链接。非常感谢!