trying to return out of a loop in python

Viewed 16

ive been trying to run this code but it keeps giving error of no value is returned.

@app.route('/submit', methods=['POST', 'GET'])
def submit():
    if request.method == 'POST':
       data = request.form.to_dict()
       with open("database.csv", mode="a+", newline="") as database2:
         rows=[]
         for row in database2:
            rows.append(row)
         username=data["username"]
         password=data["password"]
         for row in rows:
            yeild row[0],row[2]
            if username == row[0]:
                return render_template("logon.html", logintry="username exists")
            elif password == row[1]:
                return render_template("logon.html", logintry="password exists")
            else:
                return render_template("logon.html", logintry="success")
else:
    return "ahhh problemmm"

'''

0 Answers
Related