简体   繁体   English

烧瓶,从HTML中获取价值

[英]Flask, Get value from HTML

Super simple question, I'm using flask and I want to get the string value of this array. 超级简单的问题,我正在使用flask,我想获取此数组的字符串值。 I know how to use request.fom["name"] , but I cannot assign this variable a name. 我知道如何使用request.fom["name"] ,但无法为该变量分配名称。 How would I get this variable to then put it on my next page? 如何获取此变量,然后将其放在下一页上?

{% for row in students %}
  <form action="{{ url_for('user') }}" method = "POST">
    <tr>
      {{ row[0] }} <br />
      <input type="submit">
      <p> </p> <br />
    </tr>
  </form>
{% endfor %}

I need the value of row[0], how would I assign a name to that, or just get the information? 我需要row [0]的值,如何为它分配一个名称,或者仅获取信息?

Assignment is expression and syntax for expressions in jinja follows {% %} . 赋值是表达式,jinja中表达式的语法遵循{% %} So this should work 所以这应该工作

{% set data = row[0] %}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM