I'm pretty new to python/flask programming and was just wondering on how do I pass a a character to python (Flask)?
<button type="submit" value="1">1</button>
For example, let's say I have a button 1, which I press. How would I pass the value of the button to python, so I can calculate the value of the expression? I think it should be a POST request but I am unsure.
Also is this the right form for displaying a number after pressing a button?
<output type="textfield" name="answer" value=""/>
My main problem is how do I store the expression?
Here is my current routes.py file.
import csv
import math
from flask import Flask, redirect, render_template, request, url_for
from server import app, user_input
@app.route("/", methods=["GET", "POST"])
def index():
if request.method == "POST":
numbers = request.form["numbers"] #numbers is the expression
str=""
str+numbers
eval(str)
return render_template("calculator.html")