Flask:如何通过寺庙中的get方法发送值?

时间:2017-10-10 23:25:08

标签: python input flask

我有一个HTML代码,例如:

<form action="/labeling?id={{id}}" method="get" target="hiddenFrame">
    <input type="radio" name="options" value="x" onchange="this.form.submit()"> X<br>  
    <input type="radio" name="options" value="y" onchange="this.form.submit()"> y<br>
</form>

和获取元素id的python代码:

@ app.route('/ labeling',methods = ['GET','POST']) def labeling():

    value = request.form['options']
    d_id = request.form['id']

但是它没有在GET请求中发送id的值?为什么呢?

1 个答案:

答案 0 :(得分:0)

您的import pandas as pd # import pandas data = pd.read_csv('test_output.csv') # pull in csv file data = data.iloc[::2] # chop every 2nd row from frame data.to_csv('test_output.csv',index=False) # save over csv 参数不是形式参数,请尝试:

id

或更好地使用d_id = request.args['id'] 作为方法参数:

id