通过python处理出来的文本保存到一个列表中
列表在这,列表嵌套字典
[{'name': 'tom', 'class': '12', 'age': '8', 'flag': 'chn'}, {'name': 'mike', 'class': '11', 'age': '9', 'flag': 'en'}, {'name': 'jim', 'class': '2', 'age': '7', 'flag': 'chn'}]
html代码如下
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>表格</title>
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
</head>
<body>
<h1>表格</h1>
<table class="table table-striped">
   <thead>
     <tr>
       <th>name</th>
       <th>class</th>
       <th>age</th>
       <th>flag</th>
     </tr>
   </thead>
   <tbody>
     <tr>
       <td>表格单元格</td>
       <td>表格单元格</td>
       <td>表格单元格</td>
       <td>表格单元格</td>
     </tr>
     <tr>
       <td>表格单元格</td>
       <td>表格单元格</td>
       <td>表格单元格</td>
       <td>表格单元格</td>
     </tr>
     <tr>
       <td>表格单元格</td>
       <td>表格单元格</td>
       <td>表格单元格</td>
       <td>表格单元格</td>
     </tr>
   </tbody>
 </table>
</body>
</html>
初学flask,想把一个列表里面嵌套的字典遍历到web上,web上是一个表格,多谢
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
http://dormousehole.readthedocs.io/en/latest/tutorial/templates.html#show-entries-html