-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathdynamic.py
45 lines (36 loc) · 909 Bytes
/
dynamic.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
from flask_table import create_table, Col
def main():
TableCls = create_table()\
.add_column('name', Col('Name'))\
.add_column('description', Col('Description'))
items = [dict(name='Name1', description='Description1'),
dict(name='Name2', description='Description2'),
dict(name='Name3', description='Description3')]
table = TableCls(items)
print(table.__html__())
"""Outputs:
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr>
<td>Name1</td>
<td>Description1</td>
</tr>
<tr>
<td>Name2</td>
<td>Description2</td>
</tr>
<tr>
<td>Name3</td>
<td>Description3</td>
</tr>
</tbody>
</table>
"""
if __name__ == '__main__':
main()