我正在使用烧瓶形式。当我运行下面的代码以将新数据粘贴到test.html时,它返回的URL为'/ team1 / test / [0]',而不是'/ team1 / test / 1'。请帮忙。谢谢。
@application.route('/team1/test/<mid>')
def result(mid):
cursor = g.db_conn.cursor()
sql_stmt = """
SELECT id, first_name, last_name, grade from table1
where id = %s;
"""
scores = [dict(id=row[0], first_name=row[1], last_name=row[2]) for row in cursor.fetchall()]
if len(scores) > 0:
score = scores[0]
else:
score = None
cursor.execute(sql_stmt, (id,))