【问题标题】:Combine the values of a list and print in table, first_name combines with last_name to form full_name组合一个列表的值并打印在表中,first_name 与 last_name 组合形成 full_name
【发布时间】:2019-02-08 11:30:32
【问题描述】:

需要结合List中的值作为表格的一部分显示,使用flask、bootstrap和python。我已经打印了名字和姓氏,但我不知道如何组合这些值来打印。

我已经打印了名字和姓氏,但我不知道如何组合这些值来打印需要打印,如图所示

作为图像添加的 Python 代码

  <table class="table">
        <thead>
            <tr>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Full Name</th>
            </tr>
        </thead>
        <tbody>
            {% for i in range(0,ln) %}
                <tr> 
                    {% for j in users[i] %}
                        <td>{{ users[i][j] }}</td>
                    {% endfor %}
                    <td>-</td>
                </tr>
            {% endfor %}
        </tbody>
    </table>

(https://imgur.com/a/XKj9ktj)

【问题讨论】:

    标签: python html flask


    【解决方案1】:

    试试这个。

    {% for i in range(0,ln) %}
          <tr> 
              {% for j in users[i] %}
                    <td>{{ users[i][j] }}</td>
              {% endfor %}
                    <td>
                         {% for j in users[i] %}
                            {{ users[i][j] }} 
                         {% endfor %}
                    </td>
          </tr>
    {% endfor %}
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-03-04
      • 1970-01-01
      • 2021-07-04
      • 2012-07-18
      • 1970-01-01
      • 1970-01-01
      • 2017-04-01
      • 1970-01-01
      相关资源
      最近更新 更多