python flask | how to store html input in a python variable

Solution
@app.route('/test', methods=['POST', 'GET'])
def test():
    if request.method == 'POST':
        #version 1:
        opt1 = request.form.to_dict()
        for key in opt1:
            if key == "string":
                string = opt1[key]
            if key == "float": 
                floata = opt1[key]
        print(string, floata)
        #version 2:
        string2 = request.form["string"]
        float2 = request.form["float"]
        # if you need float : floatvar = float(float2)
        print(float2)
        print(string2)

        return "success"
    else:
        return render_template('example.html')